4/22/10

remove directory

If you need to remove a directory, or files and or folders under a directory, in say, Solaris you do like this,
say to remove cache under wstemp
rm -r wstemp/*
which removes files folders under wstemp recursively.
rm test.txt
deletes test.txt file
rm -i wstemp/*
inquires and prompts yes or no for each file
In Linux
rm -f - force removes a file
rm -fr - force removes directory

In DOS -
rmdir is the command to remove a directory.
rmdir dSample
removes if dSample dir is empty.
To force remove
rmdir /S dSample
removes dSample directory but inquires
rmdir /S /Q dSample
removes dSample directory and its sub directories quietly.

Enjoy your day.

No comments: