Quote:
cp -P /mydata /mybackup
I get a message "omitting dirctory /mydata" and no files are copied.
|
I think you mean -P here (just a typo). In this case you're trying to copy a directory without the recursive -R option, hence the error "omitting directory": cp tells you it cannot copy a directory if not recursively.
Regarding the -P option, it tells to copy the parent directories of the source if they are specified on the command line (just the path, not the entire directory tree and its files). Examples: without -P:
Code:
$ cp -R /home/user/somedir/ destination/
$ ls destination
somedir
with -P:
Code:
$ cp -R -P /home/user/somedir/ destination/
$ ls destination
home
$ ls destination/home
user
$ ls destination/home/user
somedir
and with -P but without specifying the path of the source (path relative to the current working dir):
Code:
$ cp -R -P somedir/ destination/
$ ls destination
somedir
Note that the -P option has a different meaning on recent (?) versions of the cp command. For example on my OpenSuse box, with GNU coreutils-6.12, I have
Code:
-P, --no-dereference
never follow symbolic links in SOURCE
whereas the described behavior is given by
Code:
--parents
use full source file name under DIRECTORY
Hope this helps.