topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 3:15 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Problem with merging folders  (Read 4100 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Problem with merging folders
« on: May 31, 2013, 04:34 PM »
This is more like a nuisance and could be that I just don't know the right way to do this.   I have several backup drives that contain folders with hundreds of files in each.  Most are identical as they are just dated backups done 3 months apart. 

With the huge increase in drive size I have been asked to put all the contents together onto a single drive. Copying folder A on a backup drive into the folder A on the Main drive.  Normally, I get the message that the file already exists do I want to overwrite or skip.  Since the files are identical I could just say overwrite and let it run.  But it takes a LOT longer to do that than to say skip.  Then when done delete the folder, files and all from the backup drive But there are many copies of these backups so I have to do this until all the folders are only on the one main drive, then make a single backup.

I was wondering if there is a command line switch that would say IF the file already exists on the target drive then delete it from the one you are copying from saving me having to go back and delete all these folders and files. 

Something that would >copy from A to B and if the file is already on B then delete it from A. 

Thanks .. I will probably feel foolish when someone tells me that is a normal  command line switch

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Problem with merging folders
« Reply #1 on: May 31, 2013, 05:50 PM »
What version of OS are you on? Windows 7 has a couple of built in tools for some of this kind of thing. I remember from work that it would do things like "keep the duplicate second copy" or "use this solution for all conflicts". Then you really could set it going, then go to lunch or something.


4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Problem with merging folders
« Reply #2 on: May 31, 2013, 10:07 PM »
robocopy <source> <dest>

From SuperUser:
Code: Text [Select]
  1. File        Exists In   Exists In        Source/Dest     Source/Dest   Source/Dest
  2. Class       Source      Destination      File Times      File Sizes    Attributes
  3. =========== =========== ================ =============== ============= ============
  4. Lonely      Yes         No               n/a             n/a           n/a
  5. Tweaked     Yes         Yes              Equal           Equal         Different
  6. Same        Yes         Yes              Equal           Equal         Equal
  7. Changed     Yes         Yes              Equal           Different     n/a
  8. Newer       Yes         Yes              Source > Dest   n/a           n/a
  9. Older       Yes         Yes              Source < Dest   n/a           n/a
  10. Extra       No          Yes              n/a             n/a           n/a
  11. Mismatched  Yes (file)  Yes (directory)  n/a             n/a           n/a
By default, Lonely files (and directories) are always copied, unless /XL switch is used. Changed, Newer and Older files will be considered to be candidates for copying (subject to further filtering described below), Same files will be skipped (not copied), and Extra and Mismatched files (and directories) will simply be reported in the output log.

Normally, Tweaked files are neither identified nor copied – they are usually identified as Same files by default. Only when switch /IT is used will the distinction between Same and Tweaked files be made, and only then will Tweaked files be copied.

So if the source and dest files are really the same, (file date and size), you can just delete the whole directory after it's run.
« Last Edit: June 01, 2013, 12:17 AM by 4wd »

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Problem with merging folders
« Reply #3 on: September 07, 2013, 09:53 PM »
Sorry.   I really have to find the option for "notify me when a reply is posted". 
Or figure out where they go when I get them.
Thanks for the Useful tip on Robo-Copy.  I am SOOOO Old School.  Still write batch files with X-copy :)
Robo would probably do it very nicely.  Has all the Whistles and Bells DOS left out in X-copy

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Problem with merging folders
« Reply #4 on: September 07, 2013, 10:41 PM »
Sorry.   I really have to find the option for "notify me when a reply is posted".

2013-09-08 13_42_03-Preview - Re_ Problem with merging folders - DonationCoder.com - Pale Moon.png

You need to go to the full reply editor by clicking Preview.

Or figure out where they go when I get them.

I'll leave you to figure that one out  ;D