7

I have a folder called "AeroFS", and another one called "AeroFS Backup".

"AeroFS Backup" contains everything that "AeroFS" contains, and more.

I need to merge "AeroFS Backup" back into the "AeroFS" folder, but not overwrite ANY existing files, even if they are newer.

I'm not particularly comfortable with terminal commands, but may give them a try.

Is there a free app that can do this without overwriting existing files at all?

4
  • man mv might be a good place to start :-)
    – nohillside
    Commented Aug 17, 2017 at 9:41
  • I'm trying with RSync however it's not behaving correctly, and instead is copying the folder within the folder selected.
    – HippoDuck
    Commented Aug 17, 2017 at 10:18
  • Sounds like you may have a trailing slash in your rsync command where you shouldn't, or vice versa. See this answer.
    – calum_b
    Commented Aug 17, 2017 at 12:57
  • Try rsync -av --ignore-existing source/ destination
    – fd0
    Commented Aug 17, 2017 at 13:38

5 Answers 5

8

Not sure why the other answer was deleted, it was almost right.

I use the terminal command to do this:

cp -n -v '/src'/* '/dest'

cp = Copy

-n = Don't overwrite existing

-v = Verbose output

2
  • 2
    For anyone doing this with directory trees, -r for recursive. Commented Sep 30, 2019 at 18:17
  • @PeterDeWeese I was sure it worked without that option but don't have access to a Mac to test anymore. Thanks for your input.
    – HippoDuck
    Commented Oct 1, 2019 at 7:59
2

Without using terminal, you can drag your files from the origin folder (AeroFS Backup) to the destination folder (AeroFS) and when Finder realizes that the same file exists, it will show an alert, asking you what you want it to do. If you press "Option" while looking at that alert, one of the options will change to "Skip" and you can then apply that to all the files that you are dragging over.

I recorded a brief video showing this in action


Using Terminal, I highly recommend the RSYNC solution:

rsync -av --ignore-existing sourceFolder/ destinationFolder
1

You can do this in Terminal with a short script:

for file in /source/directory; do $time=date +%s; if [[ -f /target/directory/$file ]]; then cp $file ${file}-${time}; else cp $file /target/directory/$file; fi; done

This will check to see if the file already exists and if it does it will append the time in seconds to the destination filename and copy it over. The advantage this has over just doing a -v verbose or -n no overwrite is that it will ensure there are no multiple duplicates.

Additionally, this has the added advantage that if the filenames are the same but are different in size/content it gives you the opportunity to see the potential dupes and deal with them.

0

Depending on the version of macOS you're running, you could just select all the files in AeroFS Backup and drag them into the AeroFS folder. When you do you'll get prompted as below:

enter image description here

If you then tick the Apply to ALL checkbox and click on the Keep Both button, you'll merge the files as you want. (In older versions of macOS you may be prompted with the Merge button instead of the Keep Both button). If you don't get either option, try holding the Option key down as you drag the files across.

IMPORTANT - Before doing this with the folders you want, I would create a couple of test folders (or just make copies of the folders you want to merge) and then test this behaviour, as I'm not sure what versions of macOS originally offered this functionality.

6
  • Unfortunately this isn't what we want. It still copies the files over and makes duplicates of all the ones that already exist. We need a "Skip" option".
    – HippoDuck
    Commented Aug 17, 2017 at 10:27
  • Hmm, I'm a little confused. If you want to merge the folders without overwriting any existing files, isn't this exactly what you need? Apologies if I'm missing something obvious, it's been one of those days. :(
    – Monomeeth
    Commented Aug 17, 2017 at 10:31
  • No, The two folders are identical, except that the backup folder contains more files. If I were to merge them, then all the existing files will end up with duplicates.
    – HippoDuck
    Commented Aug 17, 2017 at 10:33
  • Okay, well, if you get the Keep Both option by default, then pressing the Option key down will change the option from Keep Both to Skip instead.
    – Monomeeth
    Commented Aug 17, 2017 at 10:38
  • The Skip option isn't there at all. Tried holding down all the keys.
    – HippoDuck
    Commented Aug 18, 2017 at 15:15
0

Synkron might well do exactly what you want. The price is right. It has plenty of features. I use it to sync from my master folder on Mac over to an NTFS folder on a Raspberry pi HD. It does not go wild copying files that are already there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .