jlinebaugh
MIS
Here is what I am doing:
1 - Enumerate all subfolders in "C:\DirectMail" and if the folder does not exist in "C:\Archive" then create it
2 - Enumerate all files in all subfolders of "C:\DirectMail" and if the file is older than 14 days then move it to its respective folder in "C:\Archive"
Example: Move these files to their respective folders
C:\DirectMail\ATT\NEW_File.txt
C:\DirectMail\Home\Home.txt
Move to if > 14 days
C:\Archive\ATT\NEW_File.txt
C:\DirectMail\Home\Home.txt
Here is the first part of the script that I have:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\DirectMail")
Set colSubfolders = objFolder.Subfolders
strDestFolder = "C:\Archive"
strSourceFolder = "C:\DirectMail"
For Each objSubfolder in colSubfolders
If Not objFSO.FolderExists(strDestFolder & "\" & objSubFolder.Name) Then
objFSO.CreateFolder(StrDestFolder & "\" & objSubFolder.Name)
End If
Next
I just need to be able to go through all the files in C:\DirectMail\*all subfolders* and move the ones that are older than 14 days.
I am almost there, but I have trouble with variables
Any help would be greatly appreciated
Thanks
Jake
1 - Enumerate all subfolders in "C:\DirectMail" and if the folder does not exist in "C:\Archive" then create it
2 - Enumerate all files in all subfolders of "C:\DirectMail" and if the file is older than 14 days then move it to its respective folder in "C:\Archive"
Example: Move these files to their respective folders
C:\DirectMail\ATT\NEW_File.txt
C:\DirectMail\Home\Home.txt
Move to if > 14 days
C:\Archive\ATT\NEW_File.txt
C:\DirectMail\Home\Home.txt
Here is the first part of the script that I have:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\DirectMail")
Set colSubfolders = objFolder.Subfolders
strDestFolder = "C:\Archive"
strSourceFolder = "C:\DirectMail"
For Each objSubfolder in colSubfolders
If Not objFSO.FolderExists(strDestFolder & "\" & objSubFolder.Name) Then
objFSO.CreateFolder(StrDestFolder & "\" & objSubFolder.Name)
End If
Next
I just need to be able to go through all the files in C:\DirectMail\*all subfolders* and move the ones that are older than 14 days.
I am almost there, but I have trouble with variables
Any help would be greatly appreciated
Thanks
Jake