|
-
Dec 5th, 2006, 10:45 AM
#1
Thread Starter
New Member
Help me move dated files
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)
-
Dec 5th, 2006, 11:52 AM
#2
Thread Starter
New Member
Re: Help me move dated files
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.
-
Dec 7th, 2006, 08:47 PM
#3
PowerPoster
Re: Help me move dated files
give me an example of the date for a folder name ...
also is this on the local hard drive?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|