Skipping .DS_Store files when copying between two external drives

There are quite a few questions on .DS_Store files already, but none seem to answer my problem.

I have an external hard drive with a dozen of ~ 50 GB backup folders. When I try to copy these folders to a new external hard drive by drag-and-drop, it fails because

.DS_Store already exists and could not copied.
[Stop]

To circumvent this issue, how can I skip copying .DS_Store files when copying between two hard drives?

A Terminal command solution certainly exists, but I am not well-versed enough in cp to find it myself. All help appreciated!

P.S. Both disks are Mac OS X Extended (Journaled).


Try rsync -rv --exclude=.DS_Store <source> <destination> from terminal.

for example

rsync -rv --exclude=.DS_Store ~/Documents /Volumes/Backup/Documents

will do:

  • (-r) recursive (copy everything below ~/Documents)
  • (-v) verbose (tell you what it's doing)
  • (--exclude) excluding any file named .DS_Store
  • from ~/Documents
  • to /Volumes/Backup/Documents

rsync is like a suped up cp command with way more options, most specifically --exclude