Solved

Need Help with a Batch File

Hi guys

I need to orginize a folder full of scanned document for like 2 years now, i need help writing a batch file to sort the file in to folders according to the Year and month they are created.

i Googled around found some tools, but there is no way to automate this every month via the task scheduler.

Please help me guys Thanks a Load in advance
8 answers Last reply Best Answer
More about need batch file
  1. So you want it to check the year and month of all the files in a directory, create new directories with a name that is month and year, then put the files in the appropriate directory. Does that sound right?

    What file extension are they? Will there be files of any other extension in the directory?
  2. If you want help, please answer my questions. I have something done in VB.Net that might work for you.
  3. It would be interesting to try out with a CMD batch file. Can you also give some examples of the file names and how you would like the folders to look like.
  4. What the guy wanted to do with a batch file was a bit complicated for me, however, it was really easy to do with VB. I'd be curious to see what you come up with using a batch.

    In my VB program an example of folder that I created would be "2011 Jun", then I just dump any file that was created that in that month and year into it. I had a bunch of random .jpg's handy so I toyed around with those.
  5. dmroeder said:
    What the guy wanted to do with a batch file was a bit complicated for me, however, it was really easy to do with VB. I'd be curious to see what you come up with using a batch.


    I will throw something together using CMD and then we can compare it. :)
  6. Best answer
    This sort of thing is really easy to do in PowerShell if you know how to use it:

    $FromFolder = "D:\Photos"
    $ToFolder = "D:\SortedPhotos"

    get-childitem $FromFolder -recurse -include *.jpg |
    foreach-object {
    $FolderName = "$ToFolder\{0}-{1:00}" -f $_.LastWriteTime.Year, $_.LastWriteTime.Month
    if ( -not (test-path $FolderName) ) { mkdir $FolderName | out-null }
    $_.MoveTo( $FolderName + "\" + $_.Name )
    }
  7. Dman THG dosent send a notification when there is a reply totaly missed to check the thread..

    i managed to find a VB script and modify it..Thank you so much for your input guys...so sorry i didnt get to reply
  8. Best answer selected by malindar.
Ask a new question

Read More

Document Windows 7