Results 1 to 3 of 3

Thread: Help me move dated files

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    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)

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    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.

  3. #3
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    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
  •  



Click Here to Expand Forum to Full Width