Search the Community
Showing results for tags 'Old files'.
-
Hi guys, I see many script for delete files older then x in this forum, i found this and i think is very useful: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 _FilesOlder(@ScriptDir, "*.*", 7, 1) ; Look for wildcards in the Help file. ; _FilesOlder("DIRECTORY", "FILTER [Default *.*]", "NUMBER OF DAYS [Default 0]", "RECURSIVE SEARCH [Default 1 - Yes]") Func _FilesOlder($sFilePath, $sFilter = "*.*", $iDate = 0, $iRecursive = 1) Local $aFilter, $sCommand = "del /q @path", $sDate = "", $sRecursive = "" $sFilePath = StringRegExpReplace($sFilePath, "[/]+z", "") & "" If $iDate > 0 Then $sDate = "/d -" & $iDate EndIf If $iRecursive Then $sRecursive = "/S" EndIf $aFilter = StringSplit($sFilter, ';') For $A = 1 To $aFilter[0] RunWait(@ComSpec & ' /c ' & 'forfiles /P ' & $sFilePath & ' ' & $sRecursive & ' /M ' & $aFilter[$A] & ' ' & $sDate & ' /C ' & ' "cmd /c ' & $sCommand & '"', $sFilePath, @SW_HIDE) Next EndFunc ;==>_FilesOlder But for me not work, don't delete any files. What is the problem? Thanks
-
Right now i have several batch file backups running of just raw user data. basically running: xcopy {current location} {target locatiion} /d /c /e /h /r /q /y i see that autoIT has a DirCopy command, but im wondering if it has an option like xcopy to skip that file and continue on if it has a problem (/c) the batch files work nicely, but im trying to get rid of old files from the backup location. Ran into this problem several times ex: "i deleted that file. its not supposed to exist for legal reasons". kind of not what im looking for. So basically im wondering if we can get some kind of loop going to copy over every file while ignoring errors and overwrite without prompting, then go through and delete files that are not age appropriate. i understand comparing to _NowCalcDate, but the problem is with entering subfolders and scanning them as well. not looking for the script to be written for me as there are other things (error reports and the like) but just somewhere to start