Copying, moving or deleting directories

by Sanju 2009-11-20 18:43:45

Copying, moving or deleting directories


To create a new directory:

mkdir newdir



To copy the directory 'dir' in the destination directory 'destdir':

cp -a dir destdir



(Note: the '-a' option does a recursive copy - that is includes the subdirectories - and preserves the attributes of files)

To move the whole directory 'dir' inside the existing 'destdir':

mv dir1 destdir



To rename directory 'dir' as 'dir2':

mv dir dir2



To delete the directory 'dir' and all its content:

rm -rf dir


Tagged in:

998
like
0
dislike
0
mail
flag

You must LOGIN to add comments