For copying large files (and/or large quantities of files), especially across disks, I prefer to avoid using the Finder as it often fails with some meaningless error message and/or complaint about permissions.
Instead I have been looking at using rsync
— or, more specifically, the latest version of rsync
available from Homebrew, which, as of today, is:
rsync version 3.1.1 protocol version 31
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes, no prealloc, file-flags
(Those are the default capabilities that Homebrew uses.)
The problem is that rsync
is hopelessly complex, and I'm never sure if I am using the proper arguments, or if there are others that I should be using:
rsync \
--8-bit-output \
--acls \
--backup \
--devices \
--exclude='.DS_Store' \
--executability \
--group \
--human-readable \
--inplace \
--itemize-changes \
--owner \
--perms \
--progress \
--prune-empty-dirs \
--recursive \
--safe-links \
--specials \
--stats \
--times \
--update \
--verbose \
--xattrs \
'foo' /path/to/destination/
Args I'm not sure if I should be using or not, mostly because I'm not 100% sure what they do:
- (one of the other options for links instead of '–safe-links')
- –relative
- –sparse
- –partial
Any other suggestions?
Best Answer
Unless you have some specific needs, I would throw out most of those options and keep it simple:
rysnc -aEv
(on the default OS X version) orrsync -aXv
(on the Homebrew version).Options
-a
is archive mode, which essentially means preserve the metadata (timestamps, permissions, etc.) and do a recursive copy. This is what you want for your standard backup or copy operations.-E
/-X
preserves extended attributes (a.k.a. resource forks). In the past the built-in rsync version had special functionality to cover HFS+ quirks in this regard, but newer default versions of rsync may be improved in that regard now. I would lean towards using the built-in version unless you have a specific reason not to.-v
is the verbose option, and simply makes it easier to track what's going on if you're running this in a Terminal window. If it's going to be running in a script, you can remove it.Unless you know you need them, you can safely ignore most of those options you've got already. Some are duplicated by the archive command, and others (like
--inplace
, which can slow things down and leave the filesystem in an inconsistent state) are only necessary for specific edge cases. Do yourself a favour and keep things simple — if you run into specific issues with the options I've listed, perhaps enumerate those (in a separate question if need be).As an aside, running into problems copying via Finder is a bit of a red flag IMO. While it may not always be as fast as some options, it shouldn't be throwing error messages. You may want to verify/repair your disk in Disk Utility.