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

  • Working in the terminal is sometimes like scratching around in the dark as a blind man. You think you have achieved something but you can't see whether or not you actually did. So it is pretty useful sometimes to be able to quickly switch users and check if your changes actually works. Of course, this is pretty ...

  • To generate a back up of a crontab file is actually pretty simple, making use of the built in -l switch that comes with the command: sudo crontab -l > ~/path/to/your/backup/file See what we did there? The -l switch spits out the crontab file's contents and we simply pipe that into a file. Easy peasy. Note tha ...

About Craig Lotter

Craig Lotter is an established web developer and application programmer, with strong creative urges (which keep bursting out at the most inopportune moments) and a seemingly insatiable need to love all things animated. Living in the beautiful coastal town of Gordon's Bay in South Africa, he games, develops, takes in animated fare, trains under the Funakoshi karate style and for the most part, simply enjoys life with his amazing wife and daughter. Oh, and he draws ever now and then too.