Results 1 to 10 of 10
  1. #1
    New Lounger
    Join Date
    Apr 2015
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Moving multiple files into their respective folders

    Greetings, everyone.

    I have a folder with thousands of files that I have to organize into their own respective folders. I've used the command prompt listed here and it's partially fulfilled what I've needed done except when it comes to files that have mildly different naming conventions:

    ABC(A)123_321 PT.1_VER_1
    ABC(A)123_321 PT.1_VER_1A

    The command prompt above would toss the "VER_1A" files into the "VER_1" folder, returning the error "The filename, directory name, or volume label syntax is incorrect" for the "VER_1A" folder itself.

    I've tried searching for possible ways to configure the command but my limited understanding of how it functions proved to be insufficient.

    Therefore, any and all advice on how I could solve the above would be greatly appreciated.

    Cheers!

  2. #2
    jwoods
    Guest
    I think there was caveat by the poster in that thread that said he had not tested the solution.

    You might familiarize yourself with batch files and the COPY command...

    http://www.instructables.com/id/Basi...OPY-and-XCOPY/

  3. #3
    WS Lounge VIP Calimanco's Avatar
    Join Date
    Dec 2009
    Location
    UK
    Posts
    722
    Thanks
    1
    Thanked 145 Times in 131 Posts
    Open the folder. Hold down the Ctrl key and select any number of files by left clicking on each in turn to highlight it. Right click on any highlighted file and click on copy (you could use cut, but then you'd have no backup if you hit a problem so I would suggest copying the entire folder to a flash drive to act as a back up before starting. You should probably do that anyway.) This will copy all the highlighted files. Open the new folder, right click and paste your saved files into it.

  4. #4
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,202
    Thanks
    49
    Thanked 987 Times in 917 Posts
    The original copy assumes you want any files that start with the directory name placed in the directory. If you want an exact match we need to know the criteria for matching files with folders.
    Can you provide an example of the files and folders based on your first post? We need to know what bit of the file is OK to match and what bit is allowed to change.

    cheers, Paul

  5. #5
    New Lounger
    Join Date
    Apr 2015
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @Calimanco
    Touche. A tried and tested solution no doubt but it's awfully time-consuming and prone to human errors when I'm looking at thousands of files that have to go into a thousand different folders. Point taken though and will keep that in mind for when I'm dealing with an amount less...ridiculous.

    @Paul
    First and foremost, thank you truly for the original copy. You have no idea how much time and effort it saved me for files which have more direct and unique naming conventions.

    My scenario is identical to the original poster's in the other thread. All the files and folders I'm looking to move are housed within the same directory (F:\Databank). Some samples of the files and folders I'm looking at are:

    F:\Databank\TAR(FIN)A17995_VER 1\
    F:\Databank\TAR(FIN)A17995_VER 1A\
    F:\Databank\TAR(FIN)A17995_VER 1B\
    F:\Databank\TAR(FIN)A17995_VER 2\
    F:\Databank\TAR(FIN)A17995_VER 1.pdf
    F:\Databank\TAR(FIN)A17995_VER 1.txt
    F:\Databank\TAR(FIN)A17995_VER 1A.pdf
    F:\Databank\TAR(FIN)A17995_VER 1A.txt
    F:\Databank\TAR(FIN)A17995_VER 1B.pdf
    F:\Databank\TAR(FIN)A17995_VER 1B.txt
    F:\Databank\TAR(FIN)A17995_VER 2.pdf
    F:\Databank\TAR(FIN)A17995_VER 2.txt

    What I have to do is to move the .pdf and .txt files to their respective folders. With the command you shared in the other thread, it basically gets 75% of the job done, except for files which have an extended component (e.g. VER 1A & VER 1B). These files get moved into the same folder as it's root file (e.g. VER 1), essentially leaving their own folders blank and unused.

    Normally, I wouldn't mind cutting/pasting these runaway files into their intended folders but I have ~2,000 files with these extended components in this current batch.

    As such, I really need a foolproof method to do this so that I don't have to go through these folders again if a file has been misplaced due to human error...or before I bawl my eyes out scrutinizing each and every file title while herding them into their own pen.

    Cheers!
    Last edited by Stan Wyers; 2015-04-08 at 00:06.

  6. #6
    Silver Lounger RolandJS's Avatar
    Join Date
    Dec 2009
    Location
    Austin metro area TX USA
    Posts
    1,735
    Thanks
    95
    Thanked 128 Times in 125 Posts
    Stan, I must be a mushroom, in the dark, in your opening, exactly where is the exact copy or xcopy command you are using? I'm an old batchfile dude, somewhere between Beginner and Duffer.
    Last edited by RolandJS; 2015-04-08 at 11:09.
    "Take care of thy backups and thy restores shall take care of thee." Ben Franklin revisited.
    http://collegecafe.fr.yuku.com/forum...-Technologies/

  7. #7
    jwoods
    Guest
    You might take a look at Beyond Compare from Scooter Software...

    It has excellent filtering capabilities, and will show diffferences in the files and folders (added files, changed files, deleted files) in the source and target data folders.

    Syncing between folders is a 2 click process.

    http://www.scootersoftware.com

    Well worth the price of admission for everyday, or one-off projects.

  8. #8
    New Lounger
    Join Date
    Apr 2015
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @RolandJS
    My bad. I just didn't shine the light very well on what I was doing. The command prompt I'm currently using is by Paul, which he had done for another user in this other thread:
    Code:
    for /f "tokens=*" %x in ('dir /ad /b') do move "%x*.*" "%x\"
    @jwoods
    Many thanks for the recommendation. However, after messing around with it for a while, I believe it doesn't have a feature to send files into folders.

    It's compare function though, that I could put to good use when I'm doing some housekeeping to ensure that I don't accidentally delete files which I have yet to back up.

  9. #9
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,202
    Thanks
    49
    Thanked 987 Times in 917 Posts
    As the only thing that is allowed to change is the extension we can do it very easily.
    Code:
    for /f "tokens=*" %x in ('dir /ad /b') do move "%x.*" "%x\"
    cheers, Paul

  10. #10
    jwoods
    Guest
    Quote Originally Posted by Stan Wyers View Post
    @jwoods
    Many thanks for the recommendation. However, after messing around with it for a while, I believe it doesn't have a feature to send files into folders.

    It's compare function though, that I could put to good use when I'm doing some housekeeping to ensure that I don't accidentally delete files which I have yet to back up.
    You certainly can send files to folders...that's primarily what I use it for.

    Take a look at the online help section Commands Reference > Folder Compare.

    http://www.scootersoftware.com/v4help/
    Last edited by jwoods; 2015-04-08 at 14:02.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •