Here's what I am trying to accomplish:
I have a source folder (example: H:\Ermx Processing\Davie) that will contain a folder named as the date (todays date example: H:\Ermx Processing\Davie\1119)
I want to rename this date folder to this: H:\Ermx Processing\Davie\1119D and then move it to a destination directory (example H:\Ermx Processing\Davie\2007 Done).
I also have several other folder within the H:\Ermx Processing\ directory that I want to do the same thing, and I'd like to have one single script file to do this. I can adjust the first script to reflect the others, I just can't get the first one to work.
Here is what i have so far, and when I try and run it, I get a permission error. I know I can run scripts to this directory because I have another script setup to copy all files of a certain type to a different directory...and I can manually rename and move this folder so I would assume my permissions should be fine.
Expand|Select|Wrap|Line Numbers
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- myFolder = "H:\Ermx Processing\Davie" 'source folder
- destFolder = "H:\Ermx Processing\Davie\2007 Done" 'destination folder
- theDay = Day(Now)
- If Len(theDay) < 2 Then
- theDay = "0"&theDay 'put 0 if single digit day
- End If
- theMonth = Month(Now)
- If Len(theMonth) < 2 Then
- theMonth = "0"&theMonth 'put 0 if single digit month
- End If
- theDir = theMonth & theDay
- myFolder= myFolder&"\"&theDir 'define pdf folder
- If Not objFSO.FolderExists(myFolder) Then
- WScript.Echo "Folder " , myFolder ,"does not exists"
- ON ERROR RESUME NEXT
- End If
- For Each myFiles In objFSO.GetFolder(myFolder).Files
- If objFSO.FolderExists(myfolder) Then
- objFSO.MoveFolder myfolder , destFolder&"\"&myfolder&"D"
- End If
- NEXT