Dim fso As Object
Dim f As Object
Set fso = CreateObject("scripting.fi
For Each f In fso.GetFolder("C:\").Files
Debug.Print f.Name, f.DateLastModified
Next f
Set f = Nothing
Set fso = Nothing
Now this sample will only list the files and date they were last modified. To actually make the script delete, you will need to change the DEBUG.PRINT to this...
if f.datelastmodified < dateadd("d",-7,now()) then
f.delete
end if
The "d" means we are adding days
The -7 means we are adding minus seven days or subtracting 7 days from today's exact date and time.
Play with it and get it to do what you really want.
PS: Don't forget to run this on a test forlder or bad things will happen to your files.
Main Topics
Browse All Topics





by: aplimediaPosted on 2006-11-03 at 08:07:24ID: 17867484
Best move this this question to Visual basics... you are not going to get much help here in Javascript
Aplimedia