Herm Posted May 23, 2008 Posted May 23, 2008 I want to delete all files in one folder with the Attribute Archive is Off. 1. With FileSetAttrib ( "C:\Temp\*.txt", "-A") I can set all textfiles Archive bit off. 2. After that I place new files an overwrite files in that folder. 3. After that I want to delete all files with the Archive bit is off. (old files) Other files have the Archive bit On. (new files) I can't do that with the function FileGetAttrib() Has someone the solution for me?
ChrisL Posted May 23, 2008 Posted May 23, 2008 This deletes files in a given folder that do not have te Archive attribute set _DeleteNoneArchiveFiles ("C:\temp");replace with your search directory Func _DeleteNoneArchiveFiles($current) If StringRight($current,1) = "\" then $current = StringTrimRight($current,1) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") Then IF NOT StringInStr(FileGetAttrib($current & "\" & $file),"A") then FileDelete($current & "\" & $file);delete the found file without the archive attribute set EndIf WEnd FileClose($search) EndFunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ChrisL Posted May 23, 2008 Posted May 23, 2008 (edited) Opps Forum went a bit skitz then and double posted Edited May 23, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now