BULK creating of folders based on file names, and then moving files in


  1. Posts : 2
    Wn 7 64
       #1

    BULK creating of folders based on file names, and then moving files in


    Hi Everyone,

    i have been looking for weeks for a way to do this and i have tried so many applications but i just cant seem to get it right, i was hoping that you guys my be able to help me out here with this one..

    i have two folders, at the moment with identical file names in the ( they are images names are the same but one is a before and one an after ) and i need to move them into a third folder but create a file based on the image name and then a sub file for them image from folder one called ALT_1 and for the after shot subfolder but separate folder ALT_2

    so the two inputs would be for each image
    \Desktop\DNA-RAW\a01052.jpg
    \Desktop\DNA-AFTER\a01052.jpg

    output folder would be
    \Desktop\DNA-FINAL\a01052\ALT_1\a01052.jpg (raw shot)
    \Desktop\DNA-FINAL\a01052\ALT_2\a01052.jpg (after shot)

    ive never done any programing before and im really stuck on how to sort these two out .. any help anyone can give would be really appreciated, or even if you can point me in the direction of an application that i can use for this one that would be awesome

    oh yeah BTW i am running win 7 64 bit..

    thanks so much in advance

    JP !
      My Computer


  2. Posts : 1,049
    Windows 7 Pro 32
       #2

    Hi JP and welcome to SevenForums!

    I'm sure I or someone else here can create a batch file for you for this. Some questions:

    We basically only need to loop through all files in the DNA-RAW folder, assuming that DNA-AFTER holds the same file names?
    Is it all files or only jpg?
    DNA-RAW = ALT_1
    DNA-AFTER = ALT_2
    And the files should be moved, not copied.
      My Computer


  3. Posts : 2
    Wn 7 64
    Thread Starter
       #3

    Hi Tookeri !

    Copied or moved is fine, i can back them up before i anything so which ever is easier.. the thing that concerns me is that a file needs to be created within the

    \Desktop\DNA-FINAL\

    destination of the file name, and then within that file ALT_1 needs be created and then the first file moved,

    \Desktop\DNA-FINAL\a01052\ALT_1\a01052.jpg

    where is in the second image shares the sub file,

    \Desktop\DNA-FINAL\a01052\

    but still needs to have the file ALT_2 created and then the second image inserted into it..

    sorry if im spelling it all out super basically, im not sure if i explained it properly the first time, and im sure for some one who know it seems super easy but to me i have 1000' of each of these images and im a bit confused on what would be the best move
      My Computer


  4. Posts : 1,049
    Windows 7 Pro 32
       #4

    You keep saying file and sub file but you mean folder and sub-folder, right?

    I have to go now but I'll try to look at it tomorrow or the day after (unless someone else beats me to it)
      My Computer


  5. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #5

    Hey guys,

    Forgive me Tookeri, but allow myself to beat you to it .

    JPnottosure, I'm going to assume that you in fact meant 'folder' instead of 'sub\file' that you mentioned multiple times in your previous post, as Tookeri has pointed above.

    I'm also guessing that the contents of 'Desktop\DNA-RAW' and 'Desktop\DNA-AFTER' are exactly identical. If that is the case, then this batch file may satisfy your aim:

    Code:
    @echo off
    cd %USERPROFILE%\Desktop
     
    :: Sorting images in '\Desktop\DNA-RAW'
    for /f "delims=" %%I in (' dir /b "%USERPROFILE%\Desktop\DNA-RAW\*.jpg" ') do (
        if not exist "%USERPROFILE%\Desktop\DNA-FINAL\%%~nI\ALT_1" ( md "%USERPROFILE%\Desktop\DNA-FINAL\%%~nI\ALT_1" )
        move "%USERPROFILE%\Desktop\DNA-RAW\%%~I" "%USERPROFILE%\Desktop\DNA-FINAL\%%~nI\ALT_1\"
    )
     
    :: Sorting images in '\Desktop\DNA-AFTER'
    for /f "delims=" %%I in (' dir /b "%USERPROFILE%\Desktop\DNA-AFTER\*.jpg" ') do (
        if not exist "%USERPROFILE%\Desktop\DNA-FINAL\%%~nI\ALT_2" ( md "%USERPROFILE%\Desktop\DNA-FINAL\%%~nI\ALT_2" )
        move "%USERPROFILE%\Desktop\DNA-AFTER\%%~I" "%USERPROFILE%\Desktop\DNA-FINAL\%%~nI\ALT_2\"
    )
    exit
    Place this batch file anywhere on your system and run it.
    BULK creating of folders based on file names, and then moving files in Attached Files
      My Computer


  6. Posts : 1,049
    Windows 7 Pro 32
       #6

    You're excused Nice work! Tested and approved!

    I didn't see that coming, that a new member would appear only for this. But I see you had a "down under" advantage of being able to work while I was asleep

    Welcome to the forum Pyprohly!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:02.
Find Us