$ cp --no-preserve=mode --parents /sys/power/state /tmp/test/
$ cp --no-preserve=mode --parents /sys/bus/cpu/drivers_autoprobe /tmp/test/
The second of the two lines will fail with
cp: cannot make directory ‘/tmp/test/sys/bus’: Permission denied
And the reason is that /tmp/test/sys
is created without write permission (as is the original /sys
); a normal mkdir /tmp/test/sys2
would not have done this:
$ ls -la /tmp/test/
total 32
drwxr-xr-x 3 robert.siemer domain^users 4096 Oct 11 13:56 .
drwxrwxrwt 13 root root 20480 Oct 11 13:56 ..
dr-xr-xr-x 3 robert.siemer domain^users 4096 Oct 11 13:56 sys
drwxr-xr-x 2 robert.siemer domain^users 4096 Oct 11 13:59 sys2
How can I instruct cp
to not preserve the mode, apart from --no-preserve=mode
, which does not work as I believe it should...?
Or which tool should I use to copy a list of files without preserving “anything” except symlinks?