Hello,
I'm not a script writer but I've been asked to write a script that will delete all files in 2 users folder's that are older than 5 days.
So far, I've come up with this (from TechNet):
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("e:\users\user1\*.*"), DeleteReadOnly
objFSO.DeleteFile("e:\users\user2\*.*"), DeleteReadOnly
I've scheduled a task to run the above script & it works fine, except for the fact that it deletes all the files in the folders.
The script will to use the file creation date as the trigger for when the files will be deleted.
Can anyone explain to me how I can modify the script to delete files older than 5 days?
Thx.
AD
I'm not a script writer but I've been asked to write a script that will delete all files in 2 users folder's that are older than 5 days.
So far, I've come up with this (from TechNet):
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("e:\users\user1\*.*"), DeleteReadOnly
objFSO.DeleteFile("e:\users\user2\*.*"), DeleteReadOnly
I've scheduled a task to run the above script & it works fine, except for the fact that it deletes all the files in the folders.
The script will to use the file creation date as the trigger for when the files will be deleted.
Can anyone explain to me how I can modify the script to delete files older than 5 days?
Thx.
AD