Jump to content

Deleting Directory from date


MadCoder
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 6 months later...

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..."

Link to comment
Share on other sites

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

Stefan's code looks fine, are you sure you have the directory location correct? Also, are your test files over 3 days old?

[center][/center]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...