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, 10 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




Similar help and support threads
Thread Forum
Trying to bulk replace file types in a group of folders
I am looking to replace a certain file type with another in a group of folders. I have just over 700 folders each containing a single model of a type that needs to be a different model type. I have done the easy part which is bulk converting all of the models into the new file type, but the...
General Discussion
Any trick available to rename files based upon their names in a .pdf?
I have a collection of sound files for my video editing (nature, traffic etc.). Around 2000 mp3/wav tracks. Unfortunately they have very generic names (like 0001.wav) which give no clue about their contents and therefore are not searchable. Their names are shown in a .pdf file that came with the...
General Discussion
A file editing routine in Win7 or a program to deal with bulk files
I used to see file editors back in the early days and never was able to handle them due to arcane help files, TMI and other problems associated with pedantry in lingo. Soon I will need to edit my HD of duplicates and no longer- needed items. Please don't mention the "ability" to hold down...
Software
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
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 04:31.
Twitter Facebook