0

Can someone help me understand what that means?

cp: -r not specified; omitting directory

I am trying to use this command

sudo cp /home/$USER/Documents/myfile.10 /home

Error:

cp: -r not specified; omitting directory '/home/administrator/Documents/myfile.10'

What does it mean? Why did it happen? What can I do about it?

  • Welcome to Super User. Please restrict to one question per question: either cp issue or the other. Asking for a test script without showing your research effort is not a good question; we are not a script writing service. If I were you I would get rid of this "Also ..." part (edit the question). – Kamil Maciorowski Mar 28 '19 at 12:57
  • I went ahead and edited the question to meet our standards. If you need help with LDAP (which is a separate issue) then please ask a new question. Your original question is archived here, in case you want to copy from it. You should take our tour and see How to Ask first. Good luck. – Kamil Maciorowski Mar 28 '19 at 13:22
2
cp: -r not specified; omitting directory '/home/administrator/Documents/myfile.10'

This means myfile.10 is a directory. cp won't copy it, unless you explicitly use -r (or equivalent) flag.

For cp in my Debian these are equivalent: -r, -R, --recursive. POSIX, however defines -R only (-r is mentioned as obsolescent). It says:

If source_file is of type directory, the following steps shall be taken:

  • If the -R option was not specified, cp shall write a diagnostic message to standard error, do nothing more with source_file, and go on to any remaining files.

    [...]

The conclusion is your cp does exactly what it's supposed to do. If you want to copy the whole directory, use -R. If you expected myfile.10 to be a file then you need to investigate why the discrepancy.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.