Merging directories in Win 7


  1. Posts : 12
    Win 7 Ultiamte x64
       #1

    Merging directories in Win 7


    Problem:
    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.
    Ideas?
    Thanks
      My Computer

  2.    #2

    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 Computer


  3. Posts : 797
    Windows 7 Ultimate (x64)
       #3

    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 Computer


  4. Posts : 12
    Win 7 Ultiamte x64
    Thread Starter
       #4

    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 Computer


  5. Posts : 1,180
    Windows 7 Ultimate
       #5

    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.

    Correct?

    If so, I think you are out of luck.

    However, let me dig around a bit.
      My Computer


  6. Posts : 797
    Windows 7 Ultimate (x64)
       #6

    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 Computer

  7.    #7

    Someone would have to write a script for you to run.
      My Computer


  8. Posts : 1,261
    Windows 7 Professional 32-bit SP1
       #8

    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 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 22:50.
Find Us