I have a script that looks at files' creation dates and creates folders named after the creation dates of those files. Now how would I copy or move those files into the folders with the proper date? (the files all reside in 1 folder) :confused:
Printable View
I have a script that looks at files' creation dates and creates folders named after the creation dates of those files. Now how would I copy or move those files into the folders with the proper date? (the files all reside in 1 folder) :confused:
Here's what I have so far:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set FileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='K:\EDI\Incoming\processed'} Where " _
& "ResultClass = CIM_DataFile")
For Each objFile In FileList
strDate = Left(objFile.CreationDate, 8)
path = ("K:\EDI\Incoming\processed\" &strDate)
set filesys=CreateObject("Scripting.FileSystemObject")
If Not filesys.FolderExists(path) Then
Set folder = filesys.CreateFolder(path)
End If
Next
After that I get lost on the move or copy part, I always seem to get it copied into the wrong folder and not the corresponding.
give me an example of the date for a folder name ...
also is this on the local hard drive?