Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: recursive set file attributes
The extender is used to apply the settings to files in sub folders. This has many other applications.
strTitle = "Attribute Setter" strAskLineBoxPrompt = "Upper case sets, lower unsets attributes.%@CRLF%%@CRLF%R readonly, A archive, S system, H hidden%@CRLF%Note: A is set when file has NOT been backed up." strSetAttributes=AskLine(strTitle,strAskLineBoxPrompt,"r") strStartDirectory=AskLine(strTitle,"Enter a starting directory.","C:\temp") x=0 filea="" msg="This example will change files from %strStartDirectory% down." BoxOpen(strTitle,"%x% files changed.") Pause(" ",msg) AddExtender("wsrch34I.dll") ; This adds the text search extender. handle=SrchInit(strStartDirectory,"*.*","","",16) dStart = TimeYmdHms() While 1 filea=SrchNext(handle) If filea=="" Then Break ; lower case r a s and h set to off the read only, archive, system ; and hidden attributes. Capitalized RASH sets the attributes. ; Only one attribute designation is required. The other three ; are optional. Change the "rash" to the setting you require. ; On archive bits: New files are created with the attribute bit ; A set to on. To reset all files to unbacked condition use ; this setting string: "A". That's right, just a capital A. FileAttrSet(filea,strSetAttributes) x=x+1 If x mod 10 == 0 Then BoxText("%x% files changed.") EndWhile dEnd = TimeYmdHms() dDiff = TimeDiffSecs(dEnd,dStart) SrchFree(handle) BoxShut() Delay(1) Message(strTitle,"%x% files changed.") Message(strTitle,"%dDiff% seconds elapsed.")
Article ID: W14496
Filename: Recursively Set Attributes on Files.txt
File Created: 2006:05:03:07:13:02
Last Updated: 2006:05:03:07:13:02