mcclunyboy
Registered User.
- Local time
- Yesterday, 23:15
- Joined
- Sep 8, 2009
- Messages
- 292
Hi,
I have the following script which is successful. Can someone help me add logging so I can monitor which files are getting deleted.
I have text file which I would like to use for the logging. My existing script is simply (works well).
I know I need another FSO and the use of writeline, but can someone give me some help?
I have the following script which is successful. Can someone help me add logging so I can monitor which files are getting deleted.
I have text file which I would like to use for the logging. My existing script is simply (works well).
Code:
Option Explicit
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
DeleteFiles fso.GetFolder("E:\Backups\ProgressBackups") '<-----UNC Path to folder
'---------------------------------------------------------------------------
' --- Deletes files which haven't been modified within the last 4 days ----
'---------------------------------------------------------------------------
Sub DeleteFiles(srcFolder)
Dim srcFile
For Each srcFile in srcFolder.Files
If DateDiff("d", Now, srcFile.DateLastModified) < -4 Then
fso.DeleteFile srcFile, True
End If
Next
End Sub