Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

03 Oct 2014   #1
JPnottosure

Wn 7 64
 
 
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 System SpecsSystem Spec
.
03 Oct 2014   #2
Tookeri

Windows 7 Pro 32
 
 

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 System SpecsSystem Spec
03 Oct 2014   #3
JPnottosure

Wn 7 64
 
 

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 System SpecsSystem Spec
.

03 Oct 2014   #4
Tookeri

Windows 7 Pro 32
 
 

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 System SpecsSystem Spec
04 Oct 2014   #5
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

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.


Attached Files
File Type: bat move_jpgs.bat (717 Bytes, 8 views)
My System SpecsSystem Spec
04 Oct 2014   #6
Tookeri

Windows 7 Pro 32
 
 

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 System SpecsSystem Spec
Reply

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




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Names of folders and files suddenly changed color
Very odd. My laptop has two HDs and on one of them something has happened to make the names of all the folders and files appear in blue text, rather than black. Stranger still. When I transfer any of these files or folders to another machine, the blue is transferred as well. I can't find any...
General Discussion
Removing deleted files names from folders
When I transfer a file from a folder to a CD, example, after the files have been copied to the CD, as I do not need those files there anymore, I send them to the Trash bin, but somehow they remain on the same folder with 0 bytes. I have tried everything to make the names of those files...
General Discussion
How can I list the folders, sub-folders & file names into a txt file?
How am I able to list all the files & sub-folders into a text file? Need to document listings of files. could once do this in DOS but not sure if can anymore Thx!
General Discussion
The names of files and folders are in green!
Hi, I have a strange problem. The names of some files and folders appear in green! Does anybody know why and how to get rid of this strange thing? Thank you
General Discussion
Need help creating a .bat file moving output into a variable
Hello everyone, I am looking to create a .bat file to automate task that I need to do about a thousand times. I have some experience with .bat files, however I would still consider myself a beginner. I also didn't really see a good forum for something like this so if it need to be moved I...
General Discussion
File folders and names with BC/AD dates
I'm trying to create a set of directories that show art from various eras. I want them to appear in chronological order. Thus, I want the BC years to proceed backward to 0 and then forward again after AD. I've tried putting negative numbers in front of the dates but this doesn't seem to help. Any...
General Discussion


Our Sites

Site Links

About Us

Find 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 23:11.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App