' Skript zum Löschen/Wiederherstellen von Dateiattributen ' (c) by Andreas Kästner 23-Jun-2005 ' http://a-kaestner.de andreaskaestner@web.de ' Version 1.0 24-Jun-2005 Option Explicit Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Const AttNormal = 0 Const AttReadOnly = 1 Const AttHidden = 2 Const AttSystem = 4 Const AttVolume = 8 Const AttDirectory = 16 Const AttArchive = 32 Const AttAlias = 64 Const AttCompressed = 128 Const AttChar = "RHSVDA" Dim fso, oShell Set fso = CreateObject("Scripting.FileSystemObject") Set oShell = WScript.CreateObject("WScript.Shell") Dim SetAtt, ResetAtt Set SetAtt = fso.CreateTextFile("attset.bat", vbTrue) ' overwrite Set ResetAtt = fso.CreateTextFile("attreset.bat", vbTrue) ' overwrite ' Set xFILEx = fso.OpenTextFile(fname, ForXXXing, vbTrue) ' create ' Set xFILEx = fso.OpenTextFile(fname, ForXXXing, vbFalse) ' don't create ' Set xFILEx = fso.CreateTextFile(fname, vbTrue) ' overwrite ' Set xFILEx = fso.CreateTextFile(fname, vbFalse) ' don't overwrite ' InputBox(Eingabeaufforderung[,Titel][, Standard][, xpos][, ypos] Dim oFolder Dim wrk, attr, i, ii Do wrk = Trim(InputBox("Startordner", "Dateiattribute löschen/wiederherstellen", wrk)) If wrk = vbFalse Then WScript.Quit Loop Until fso.FolderExists(wrk) attr = AttReadOnly + AttHidden + AttSystem Set oFolder = fso.GetFolder(wrk) ScanFolder oFolder SetAtt.Close ResetAtt.Close WScript.Echo i & " Einträge von insgesamt " & ii Sub ScanFolder(oDir) Dim oFile, oSub, a, wrk1, wrk2 For Each oFile in oDir.Files ii = ii + 1 wrk1 = "" : wrk2 = "" If oFile.Attributes AND attr Then If oFile.Attributes AND AttReadOnly Then wrk1 = wrk1 & " +" & Mid(AttChar, 1+Log(AttReadOnly)/Log(2), 1) wrk2 = wrk2 & " -" & Mid(AttChar, 1+Log(AttReadOnly)/Log(2), 1) End If If oFile.Attributes AND AttHidden Then wrk1 = wrk1 & " +" & Mid(AttChar, 1+Log(AttHidden)/Log(2), 1) wrk2 = wrk2 & " -" & Mid(AttChar, 1+Log(AttHidden)/Log(2), 1) End If If oFile.Attributes AND AttSystem Then wrk1 = wrk1 & " +" & Mid(AttChar, 1+Log(AttSystem)/Log(2), 1) wrk2 = wrk2 & " -" & Mid(AttChar, 1+Log(AttSystem)/Log(2), 1) End If End If If wrk1 <> "" Then SetAtt.WriteLine "attrib" & wrk1 & " " & oFile.ShortPath ResetAtt.WriteLine "attrib" & wrk2 & " " & oFile.ShortPath i = i + 1 End If Next For Each oSub in oDir.Subfolders Call ScanFolder (oSub) ' Rekursion Next End Sub