1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Syncing two folders

Discussion in 'Techno-Magic' started by SlickRCBD, Dec 29, 2014.

  1. SlickRCBD Gems: 29/31
    Latest gem: Glittering Beljuril


    Resourceful Adored Veteran

    Joined:
    May 7, 2005
    Messages:
    3,026
    Media:
    47
    Likes Received:
    173
    Gender:
    Male
    I have two folders that are supposed to be kept identical, but I allowed them to get out of sync on different computers.

    Both have files the other does not. Most methods I know would involve overwriting one folder with the other. I want something to drill down through a complex folder hierarchy and only replace files that are newer than the old ones while copying any missing files.

    The newer version might be in either folder.

    I do not want to waste the time it would take to replace identical duplicates. This is several gigabytes of data in thousands of files.

    I thought using the copy command would work, if I hit shift-N the first time it asked about duplicates, but it seems it will stop looking for files after the first level of folders.

    I thought about the old MS-DOS backup and restore commands, but they apparently were dropped with Windows XP, or were never in the NT line of products.

    Could somebody suggest a program or procedure to go through and sync up the two folders, copying what is not present on one computer to the other, or what is updated, and not overwriting the duplicates with the same size and date?

    One computer is a dual-boot Windows 98SE and Windows XP professional. The other is a dual boot of 64-bit Windows Vista Home and 7 Professional.
    Primarily I'm running the later OSes, and I rarely boot Vista except when my aunt needs help with her laptop, but I'll take any solution that works for this one-time only task. Afterwards I'll give the Microsoft Sync toy a trial run, but first I need something that works like the old MS-DOS BACKUP command and only replaces newer files to get them synced.
     
  2. Keneth Gems: 29/31
    Latest gem: Glittering Beljuril


    ★ SPS Account Holder Resourceful Adored Veteran

    Joined:
    Jul 22, 2002
    Messages:
    3,109
    Media:
    20
    Likes Received:
    224
    Gender:
    Male
    What do you mean "stop looking"? I've copied whole hierarchies of folders on multiple occasions in the past and it's always asked what to do about files even if they were more than one folder deep. Of course, the default copy options are lacking at best.

    But anyway, what you actually want is the Xcopy command which can be run from the command prompt. Use the /d switch (with no date argument) to only copy files that are newer than the destination files.

    Or, if you're on the newer systems (like Win 7), you can use Robocopy. This one is much more efficient and you can run it multithreaded with the /mt switch. You can use the /xo switch to exclude older files. If you wanna make the whole thing much simpler you can also download the Robocopy GUI published by TechNet Magazine or the RichCopy tool that is also linked to in that article which is supposed to be an improved version.
     
  3. Taluntain

    Taluntain Resident Alpha and Omega Staff Member ★ SPS Account Holder Resourceful Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) New Server Contributor [2012] (for helping Sorcerer's Place lease a new, more powerful server!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) BoM XenForo Migration Contributor [2015] (for helping support the migration to new forum software!)

    Joined:
    Jun 11, 2000
    Messages:
    23,475
    Media:
    494
    Likes Received:
    538
    Gender:
    Male
    I expect Total Commander could do it as well, though personally I've never needed this so I'm not 100% sure.
     
  4. SlickRCBD Gems: 29/31
    Latest gem: Glittering Beljuril


    Resourceful Adored Veteran

    Joined:
    May 7, 2005
    Messages:
    3,026
    Media:
    47
    Likes Received:
    173
    Gender:
    Male
    I never could get Robocopy to work right for some reason, yet I've never had a problem with Microsoft's syntax explanations for other commands dating back to the MS-DOS era. I always assumed that there were errors in the help text that they copied to the webpage.
    Thanks for the link to the GUI, I'll be trying it later when I'm ready to lock up both computers for a while. I've put a movie on reserve at the library, so I'll do the copy and then pop in the tape err, disc.
    I guess I'm showing my age, I think of borrowing tapes from the library or renting them from Blockbuster, rather than DVDs.

    ---------- Added 0 hours, 2 minutes and 10 seconds later... ----------

    Oh, do I need to map the network share to a drive letter to use Robocopy?
     
  5. Keneth Gems: 29/31
    Latest gem: Glittering Beljuril


    ★ SPS Account Holder Resourceful Adored Veteran

    Joined:
    Jul 22, 2002
    Messages:
    3,109
    Media:
    20
    Likes Received:
    224
    Gender:
    Male
    I don't think it should be necessary, but I've never tried using it with shared folders. The GUI (or at least RichCopy) should be able to handle it, otherwise just use the standard notation for accessing shared folders (e.g. \\sharedcomputer\drive$\somefolder\)

    Edit: Maybe a better example would be "\\Bob\D$\Games". I sometimes make examples generic to the point where it's actually confusing. :p
     
    Last edited: Dec 31, 2014
  6. henkie

    henkie Hammertime Resourceful Adored Veteran New Server Contributor [2012] (for helping Sorcerer's Place lease a new, more powerful server!)

    Joined:
    Jan 13, 2006
    Messages:
    2,662
    Media:
    38
    Likes Received:
    158
    Gender:
    Male
    I never understood why normal file explorer programs never have the simple options like a fairly basic FTP client would have. Like "copy if newer". Would be so useful sometimes.

    Otherwise, it should be fairly simple to write a script to do this in something like Python, but that's probably a bit overkill if there's ready-to-use programs that can do it easily as well.
     
  7. Keneth Gems: 29/31
    Latest gem: Glittering Beljuril


    ★ SPS Account Holder Resourceful Adored Veteran

    Joined:
    Jul 22, 2002
    Messages:
    3,109
    Media:
    20
    Likes Received:
    224
    Gender:
    Male
    It'd be nice if these options were already in explorer, yeah, but I imagine extra options would confuse plebs-*khem* I mean average users. This way, unsavvy people are happy, and advanced users can make use of programs like xcopy and robocopy which ship with the system (assuming they don't already use alternatives to standard explorer).
     
  8. SlickRCBD Gems: 29/31
    Latest gem: Glittering Beljuril


    Resourceful Adored Veteran

    Joined:
    May 7, 2005
    Messages:
    3,026
    Media:
    47
    Likes Received:
    173
    Gender:
    Male
    GS/OS, the Apple IIGS version of the Mac OS, had it so that if you held down the <OPTION> key on the keyboard while coping a file using the Finder (optional in GS/OS), you got presented with a dialog box with the options to
    1. Ask about each duplicate case by case
    2. Don't replace any duplicate items
    3. Replace all duplicate items
    I never understood why that feature was not implemented on the Mac as well, nor why they didn't give anything similar in Windows.

    I should also mention that an Apple IIGS was my first computer, and it came with GS/OS 4.0.

    ---------- Added 20 hours, 1 minutes and 42 seconds later... ----------

    OK, I give up.
    How do you use Robocopy or even Xcopy to check an entire directory tree with many nested folders to see if each file within exists in the other folder, and only copy if the file either doesn't exist or is newer than the destination folder.

    Robocopy with the /e and the /xo seems to only check the first level of folders, and if it sees all the folders are there, doesn't delve into them to compare the individual files in the nested directories.

    Could somebody give me the syntax to sync a folder in C:bad:users\public\documents\FAQs which has folders for each game I own on it with \\slickswintel\FAQS
    I assume I can do the same for FF, which has even more levels of nested folders.

    FF has fanfiction stories sorted by primary series, then usually by author or series, then in some multi-chaptered stories each story has its own folder if it is in multiple files.
    Code:
    Robocopy /e /xo E:\ff \\slickswintel\ff 
    seems to only look at the first level of folders and ignores any folders that don't have changed dates, so if the folder with a changed date is nested two levels down, nothing gets updated.
     
    Last edited: Jan 2, 2015
  9. argento-dtw Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Nov 24, 2012
    Messages:
    36
    Likes Received:
    1
    Gender:
    Male
  10. SlickRCBD Gems: 29/31
    Latest gem: Glittering Beljuril


    Resourceful Adored Veteran

    Joined:
    May 7, 2005
    Messages:
    3,026
    Media:
    47
    Likes Received:
    173
    Gender:
    Male
    XCOPY seemed to only check the first level of subdirectories, which had unchanged dates.
    This was the parameter I tried:
    Code:
    xcopy E:\ff \\slickswintel\ff /d /e /f
     
  11. Tula Guest

    Let me Try.
     
    Last edited by a moderator: Dec 23, 2016
  12. SlickRCBD Gems: 29/31
    Latest gem: Glittering Beljuril


    Resourceful Adored Veteran

    Joined:
    May 7, 2005
    Messages:
    3,026
    Media:
    47
    Likes Received:
    173
    Gender:
    Male
    Go ahead, it's been nearly a year, but I won't mind having an easy way to do this. The correct commands for robocopy or xcopy would be appreciated. Feel free to use post #10 as a guide for the example of the directories I want to sync. E:bad:ff and \\slickswintel\ff
    Although I could do it the other way around if necessary, set up a share for E:bad:FF. Bear in mind that Slickswintel is a Windows 98SE/Windows XP dual-boot computer that is the main file and print server for my home network, and also what I use to play old games like Baldur's Gate on (it was not obsolete when I got Baldur's Gate I, but actually my primary and best computer).
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.