Copy folders only BUT only duplicate files..

Discussion in 'macOS' started by msmth928, Mar 9, 2010.

  1. msmth928 macrumors regular

    Joined:
    Jun 3, 2009
    #1
    ...and leave others intact.

    For example, say I have a folder called Files1, and it has 10 further folders in there. And then I have another folder called Files1 too, which includes updates (new files in) just 3 of the folders.

    Is it possible to just drag the new Files1 folder over the old one BUT it just copies over the 'duplicate' files and folders? And leave the others untouched? (bit like how it works when FTP'ing files to a server).

    Default behaviour seems to completely overwrite the folder - which is not what I want.

    Any ideas?
     
  2. Gregg2 macrumors 603

    Joined:
    May 22, 2008
    Location:
    Milwaukee, WI
    #2
    It will always overwrite everything in the folder.

    I'm not getting your use of the word 'duplicates'. You seem to be saying you don't want/need it to copy over the files that were not modified in the newer folder. Is that right?

    How about this...
    Let's say you have folder 1, folder 2, and folder 3 in Files1. You change a file or two in folder 2 in the second Files1, and only want to update those files in the first Files1 folder. The way to do that is to open the Files1 folder in which the modified folder 2 files reside, and drag folder 2 to the other Files1 folder. Just don't drag folder 1 and folder 3 over, because nothing in them changed.

    Did I get it?
     
  3. msmth928 thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #3
    Yes that's it - but when you have a whole lot of nested files and folders, it becomes a pain having to copy over just the new/changed files.

    I don't just want to replace the entire folder because the 'new' folder will only contain files and folders that have been changed.

    If it's possible on a linux server, it must be on osx :-/ perhaps via terminal?
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    Look into the rsync command from Terminal (Grsync for a GUI to it). There's also some Mac apps for merging folders if that's of any help.
     
  5. msmth928 thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #5
    Thanks, look like this works :)

    cp -R -n ./source-folder/* ./destination-folder/
     
  6. Gregg2 macrumors 603

    Joined:
    May 22, 2008
    Location:
    Milwaukee, WI
    #6
    Good, but...

    Come again? If you replace the entire folder with one that has all the same files on it, including those you just modified, the replaced folder becomes identical to the other one. It will have not only the files and folders that were changed, but also those that were not changed. That is, unless your definition of entire is different from mine...
     

Share This Page