MadCoder Posted November 25, 2009 Posted November 25, 2009 I writing a script that connects to our svn and dumps the contents for nightly builds and I would like to know how I would scan my target directory for directories older than 3 days and delete them? Now sure exactly what safe steps to take.
L3viathan2142 Posted November 25, 2009 Posted November 25, 2009 I don't know whether there's a way to get the Folder's Time, but you could scan the whole Folder for Files which are newer than 3 days (FileGetTime) and if you don't find any, delete the folder. Very slow though.
99ojo Posted November 25, 2009 Posted November 25, 2009 Hi, #Include <File.au3> #Include <Date.au3> $startfolder = "" ; Put here your start folder without ending backslash $folderList=_FileListToArray($startfolder, 2) ; list folders into array If @Error=1 Then Exit For $i = 1 To UBound ($folderList) - 1 $foldertime = FileGetTime ($startfolder & "\" & $folderList [$i]) $diff = _DateDiff ("D", $foldertime [0] & "/" & $foldertime [1] & "/" & $foldertime [2], _NowCalcDate () ) If $diff > 3 Then DirRemove ($startfolder & "\" & $folderList [$i], 1) Next ;-)) Stefan
RichardT Posted May 26, 2010 Posted May 26, 2010 All, I know this is an old topic, but I need exactly what it does. But I cannot get it to work? If I turn it into an .exe or leave it as a script, it just stops without any errors? Ideas? RichardT "so much work, so little brains..."
Affe Posted May 26, 2010 Posted May 26, 2010 All,I know this is an old topic, but I need exactly what it does. But I cannot get it to work? If I turn it into an .exe or leave it as a script, it just stops without any errors?Ideas?RichardTStefan's code looks fine, are you sure you have the directory location correct? Also, are your test files over 3 days old? [center][/center]
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