Hello all,
I am trying to append a date stamp to a file name that I am copying to another folder. Here is the script I have so far.
The script works fine in finding all text files and moves them to the second folder. However, I may have files with the same name that I do not want to overwrite. Is there anything i can add that will allow me to date stamp the file name? Also, if it is possible can I append the name of the parent folder to the file name as well?
I am trying to append a date stamp to a file name that I am copying to another folder. Here is the script I have so far.
Code:
Dim strExtensions
Dim strExt
Dim strDate
strPath = "C:\Test\"
strDest = "C:\TestCopies\"
strExtensions = "txt"
strDate = "9/7/2010 6:00:00 PM"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files
For Each objSubfolder in colSubfolders
Set colFiles = objSubfolder.Files
For Each objFile in colFiles
For each strExt in SPLIT(UCASE(strExtensions),",")
If RIGHT(UCASE(objFile.Path),LEN(strExt)+1) = "." & strExt then
IF objFile.DateLastModified > (strDate) THEN
objFile.copy strDest
End If
End If
Next
Next
Next
The script works fine in finding all text files and moves them to the second folder. However, I may have files with the same name that I do not want to overwrite. Is there anything i can add that will allow me to date stamp the file name? Also, if it is possible can I append the name of the parent folder to the file name as well?