Is there any difference between cp -r /source /destination
and cp -a /source /destination
when I am copying from NTFS
to EXT4
?
Is there any difference between cp -r /source /destination
and cp -a /source /destination
when I am copying from NTFS
to EXT4
?
cp -a
attempts to make copies as close as possible to the source, including metadata and tree information.cp -r
recursively copies files and keeps the contents but yields to the user doing the copy for modification times, permissions, and user.So essentially, just use
cp -a
as it does everythingcp -r
does and more.Here is some further reading from the man page
It makes a difference when it comes to links which are located in the source directory.
cp -a
will copy the link as a link.cp -r
will follow the link, so if the link points to another directory it will copy the contents of the linked directory as well, this can make a huge different in necessary disk space when the linked directory holds a lot of data.cp -a
will also preserve file permissions, ownership and timestamps whichcp -r
doesn't. File permissions will be different, even if you copy from an NTFS-formatted partition.