Skip to main content
added 109 characters in body
Source Link
Tony Williams
  • 12.7k
  • 3
  • 34
  • 63

The copying of files on the Mac command line is a curious thing.

If both the source and the destination are on HFS, HFS+ or APFS file systems then cp will preserve special macOS attributes and since fairly early versions of macOS all extended attributes.

If you want to be slightly more secure you can use the -a option to cp which preserves absolutely everything including modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved. It also copies, rather than follows, symbolic links. Personally, this is what I use for copying apps.

For a total guarantee, including copying to other file systems such as FAT or NTFS you should use ditto —-rsrc which saves all the neat stuff in .AppleDouble files on those file systems.

If you want more information I heartily recommend a close reading of the man page of both.

mv is safe as houses so long as you are on the same volume and fine if both source and destination volumes are macOS formats.

By the way, you mistyped your example. It should be cp -pR, which is essentially the same as cp -a.

The copying of files on the Mac command line is a curious thing.

If both the source and the destination are on HFS, HFS+ or APFS file systems then cp will preserve special macOS attributes and since fairly early versions of macOS all extended attributes.

If you want to be slightly more secure you can use the -a option to cp which preserves absolutely everything including modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved. It also copies, rather than follows, symbolic links. Personally, this is what I use for copying apps.

For a total guarantee, including copying to other file systems such as FAT or NTFS you should use ditto —-rsrc which saves all the neat stuff in .AppleDouble files on those file systems.

If you want more information I heartily recommend a close reading of the man page of both.

mv is safe as houses so long as you are on the same volume and fine if both source and destination volumes are macOS formats.

The copying of files on the Mac command line is a curious thing.

If both the source and the destination are on HFS, HFS+ or APFS file systems then cp will preserve special macOS attributes and since fairly early versions of macOS all extended attributes.

If you want to be slightly more secure you can use the -a option to cp which preserves absolutely everything including modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved. It also copies, rather than follows, symbolic links. Personally, this is what I use for copying apps.

For a total guarantee, including copying to other file systems such as FAT or NTFS you should use ditto —-rsrc which saves all the neat stuff in .AppleDouble files on those file systems.

If you want more information I heartily recommend a close reading of the man page of both.

mv is safe as houses so long as you are on the same volume and fine if both source and destination volumes are macOS formats.

By the way, you mistyped your example. It should be cp -pR, which is essentially the same as cp -a.

Source Link
Tony Williams
  • 12.7k
  • 3
  • 34
  • 63

The copying of files on the Mac command line is a curious thing.

If both the source and the destination are on HFS, HFS+ or APFS file systems then cp will preserve special macOS attributes and since fairly early versions of macOS all extended attributes.

If you want to be slightly more secure you can use the -a option to cp which preserves absolutely everything including modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved. It also copies, rather than follows, symbolic links. Personally, this is what I use for copying apps.

For a total guarantee, including copying to other file systems such as FAT or NTFS you should use ditto —-rsrc which saves all the neat stuff in .AppleDouble files on those file systems.

If you want more information I heartily recommend a close reading of the man page of both.

mv is safe as houses so long as you are on the same volume and fine if both source and destination volumes are macOS formats.