Ubuntu Terminal: “cp: omitting directory” Copy Error

When attempting to copy a non-empty directory in Ubuntu using the cp command, you will be presented with the following error message:

cp: omitting directory mydirectory

To force the copy cp command to handle the non-empty directory correctly, you need to force the recursive switch using -R

So you should be entering:

cp -R mydirectory targetdirectory

And now you know.

Related Posts:

  • In order to count the number of files in a directory or folder in Ubuntu via the terminal, it is a simple matter of using the ls listing command with a numeric 1 switch and then piping its result to the line count function wc. In practice, this would retrieve the number of files in the current working directory (no ...

  • Although newer versions of Ubuntu (10.04 and up) already come with the helpful nano syntax highlighting enabled, older versions don't - though thankfully switching this on is pretty simple to achieve. To enable nano syntax highlighting for a user, first copy the nanorc file to the users home directory: cp /etc/ ...

  • To assign or add an existing user to an existing group under the Ubuntu terminal is actually quite easy if you know the command and syntax: sudo usermod -G group -a user See? Told you so! :P

About Craig Lotter

South African software development manager and senior application developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.

Leave a Reply