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: Merging directories in Win 7

02 Jul 2010   #1

Win 7 Ultiamte x64
Merging directories in Win 7

I have a directory with 10000 .jpg files. I have another directory with 5000 .jpg files that have the same names as 5000 of those in the first directory. But some are of lesser size and some greater size. I just want to merger ie replace just the smaller files in the first directory with the larger files from the second directory. Can this be done easily?
Win 7 gives me the option to do this one file at a time. WAY to slow.
Someone suggested the cmd box copy command, but I'm not sure which parameters could do this, if any.

My System SpecsSystem Spec
02 Jul 2010   #2
Microsoft MVP


What I would do is Change folder View to Details, then order the Size list either ascending or descending, highlight the size group you want to delete in First file, then delete. Now in the Second file, highlight the size group you want to copy (merge) into First folder and either drag them as a group to the First folder in Explorer tree, or copy and paste them into First folder. Finally delete the Second folder once you're sure you have everything.

You don't say if the files needing replacement have the same name as their counterparts you want to replace them with, as if they do then you could just drag the replacement files from the Second to the First file, then when it asks you if you want to replace them, say "Yes to all."
My System SpecsSystem Spec
02 Jul 2010   #3

Windows 7 Ultimate (x64)

I am not sure what do you mean by Windows 7 giving you an option to do this one by one. If you simply try to copy all files from the second directory to the first one, Windows will do this until there is a conflict, i.e. until it finds that the file you want to copy has the same name as some other file that already exist in the target directory. At this point you are given several options, such as to skip this file, keep both files or replace the file with the target directory by the new one. Windows can remember your choice - you have to check the small box at the bottom of the pop-up window with the choice options - and then do the same for all other files.

So, if you simply want to move files from second directory to the first and while doing so overwrite the files that are already there - then you simply move all, then choose replace, check "do so for all other conflicts" and you're done.

Now, if you want to do so only for some files, not all, then of course some manual tinkering will be required. Say, your second directory contains some small and some large files, and yo only want the small files to overwrite files in the target directory. Then you could sort your files by size, then select those you want to move, then do as I described above.

Hope that was not too confusing.
My System SpecsSystem Spec

02 Jul 2010   #4

Win 7 Ultiamte x64

Thanks to both replys. I guess I wasn't that clear. Let me try again.
The files in the 2nd directory (D2) have the same names as the ones in the larger 1st directory (D1). But some files are larger and some smaller in D2 then their counterparts in D1. I just want to replace just the files in D1 if the same named files in D2 are larger than the ones in D1.
gregrocker's aproach will not work well, because D1 has many more files, then D2. Sorting by size will include files in D1 that are not in D2. I wish explorer could sort by AND by size
unifex's approach will replace all files, not just the larger ones, because sometimes the bigger files in already in D1, sometimes not. I do not want to click 'Move or Don't move" 5000 times.
My System SpecsSystem Spec
02 Jul 2010   #5

Windows 7 Ultimate

Soo.. I'm gonna shorten it up a bit to make sure I have it clear, using your D1 and D2 examples above..

You want to replace all of the files in D1 with files from D2 that have the same name and larger size, and NOT have to click Move or Don't Move a bunch of times.


If so, I think you are out of luck.

However, let me dig around a bit.
My System SpecsSystem Spec
02 Jul 2010   #6

Windows 7 Ultimate (x64)

Well, are your smaller files randomly smaller or smaller because you did something to your pictures, like reduced their size? If the latter is true, i.e. your larger files are 2-3 MB pictures and your smaller files are their 100kB versions, then you can do as I outlined in my first post, namely sort your directory D2 by size, and then select smaller files, move and replace.

If, on the other hand, the first case applies, then you are basically out of luck - the only thing you could do is to write a short script that would compare the file sizes in two directories and then move the smaller ones. But I am not sure how you would do this in cmd. If you had cygwin installed, then a bash script would not be so difficult.
My System SpecsSystem Spec
02 Jul 2010   #7
Microsoft MVP


Someone would have to write a script for you to run.
My System SpecsSystem Spec
02 Jul 2010   #8

Windows 7 Ultimate x64

I'm not sure if this will do the trick for you, but it may help.

I've attached a ZIp of a little utility I wrote, Duplicate Image Finder, which scan any given set of folders for JPG files (it can take anything from a few minutes to several hours to complete a scan, depending on the number of images it finds, and the speed of you pc), and attempts to locate visually duplicated files, even if the image dimansions are different:

When scans are complete, you can select which files must be deleted or preserved, of which larger images are preserved by default.

If you don't want "duplicates" to be deleted, then I'm afraid you'll have to wait for awhile, because DPF is (for me anyway) in a perpetual state of BETA testing, and currently only allows for duplicates to be deleted. Files located in different folders can be moved one at a time.

If my time was my own, then perhaps I'd get around to allowing duplicates to be moved or copied to alternate locations all in a single pass.

Hope this helps.

My System SpecsSystem Spec

 Merging directories in Win 7

Thread Tools

Similar help and support threads
Thread Forum
Some directories share, others don't (Win 7 and XP)
I'm running a mixed home network with my main machine being Win 7 64. From a couple of XP laptops I can see the machine. I can see the "shared" directories. However some allow me to access that directory (on the Win 7 machine) while others return an error message of: "You might not have...
Network & Sharing
A Gazillion Sub-directories!
Hi All! System Drive c:\Program Data\Application Data\... I don't know how deep this directory goes but the snapshot should give you an idea of what's going on here. Is this normal? Other than the Hex numbers, they appear to be replications, ad infinitum...
Performance & Maintenance
Home Directories on Nas
Hi All, We currently have all of our users home directories located on a NAS. A coworker and I are the only ones with win7 on our machines. The problem we are experiencing is when we browse our network share that contains all of our users home directories, instead of seeing my name on my...
Network & Sharing
I have a movie split into 17 parts in .flv do I merge it?
Music, Pictures & Video
What are all these extra directories
After I installed Windows 7 and some of my programs I started noticing all these directores in the root directory. I do not know what they are, and if I can remove them. Does anyone know what these are for? $windows.~BT Blocks Config.msi i386 inetpub install2 msocache PerfLogs
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 13:21.
Twitter Facebook Google+