Copying and deleting directories

It’s quite common when you first start using linux from the command line to get the error message:

cp: omitting directory

What this means is that linux cp or rm command doesn’t work on folders or directories as standard. There is a simple fix though just add the -r modifier.

To copy a directory

cp -r /var/www/source /var/www/destination

Removing a directory

rm -r /var/www/target

Obviously be very careful when using the recursive command with remove.

Leave a Reply

Your email address will not be published. Required fields are marked *