MacOS – File Copy Error

copy/pastemacos

I copied files from one location to another using the following command.

cp -pr /path/to/source /path/to/destination

During execution, I saw the following error message on some files being copied over about chflags below.

chflags /Volumes/Share/Folder: Invalid argument

I did a file comparison with the old/new file and cannot see the difference.

Does anybody know what "invalid argument" means?

Thanks in advance.

Best Answer

According to man cp on my Mojave system, there is no r option. There is however, an R option:

-R If source_file designates a directory, cp copies the directory and the entire subtree connec of the directory are copied rather than the directory itself. This option also causes symbolic links to be copied, rather than indirected through, and for cp to create special files rather than copying them as normal files. Created directories have the same mode as the corresponding source directory, unmodified by the process' umask.

In -R mode, cp will continue copying even if errors are detected.