How is `cp -R` different from CTRL-C/CTRL-V?
-
08-03-2021 - |
Question
My system is OS X El Capitan 10.11.5. I copied from my OS X Extended filesystem to FAT32 about 30 Gb files by Ctrl+C / Ctrl+V.
Now, I received a proposal to do it by cp -R
.
I am wondering how different it is from the Ctrl+C and Ctrl+V.
How is cp -R
different from Ctrl+C and Ctrl+V?
Solution
When copying and pasting via Finder there is certain meta-data that is maintained that when using
cp -R
it's not.
An example is when copying and pasting via Finder the created/modified date/time stamp of individual files are maintained to that of the existing meta-date vs. using cp -R
where both the created/modified date/time stamp are set to the date/time of the copy operation.
On directories when copying and pasting via Finder the created date/time stamp is maintained to that of its current value and the modified date/time stamp is set to the date/time of the copy operation. vs. using cp -R
where both the created/modified date/time stamp are set to the date/time of the copy operation.
Now if you use cp -aR
the created date/time stamp is set to the date/time of the copy operation and the modified date/time stamp is maintained to it value it had at the time of the copy operation.
In essence copying and pasting via Finder maintains all meta-data attributes that are supported by the destination filesystem and to get the most possible meta-data attributes maintained using cp
then additional options must be used. Have a look at the cp
man page for additional command line options.
FAT32 does not support all of the file attributes that HFS+ does, however copying via Finder preserves more then cp
regardless of the options implemented.
OTHER TIPS
cp and rsync have a lot of options that modify which attributes (ownership, unix permissions, POSIX ACLs, resource forks in some cases!) will be/will not be transferred/reset, and how certain types of files will be included/excluded, and how links to files or directories will be handled(copying the link vs copying what it points to). It is unlikely that just using -R will get the same behaviour as what you are doing with Finder.
Also: In Finder, you can only directly select things to copy that you can see OR which are inside a folder (or anywhere in the subfolder tree of it) that you can see and that you explicitly selected. Depending on your settings that could exclude anything prefixed with "." , and probably some other structures that Finder treats as special.