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.

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).

  • Are you copying to an existing directory? I assume otherwise there would not be a .DS_Store file o the target, but in this case are you overwriting any other files
    – mmmmmm
    Commented Jul 8, 2013 at 14:03
  • I'm copying directly to the disk root, not to an existing directory, and there are no existing files on the target, so there is no overwrite.
    – Fr.
    Commented Jul 8, 2013 at 14:05
  • The error messages says there is a .DS_Store file on the target - what does ls -al show on the target?
    – mmmmmm
    Commented Jul 8, 2013 at 14:07
  • ls- al shows nothing particular: I presume it's a corrupted file issue (the .DS_Store files have been causing trouble for some time now).
    – Fr.
    Commented Jul 9, 2013 at 6:28
  • 1
    However rsync is often the better way anyway
    – mmmmmm
    Commented Jul 10, 2013 at 18:53

1 Answer 1


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

  • That is exactly what I was looking for, thank you!
    – Fr.
    Commented Jul 9, 2013 at 3:36

You must log in to answer this question.

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