November 20th, 2003, 03:14 AM
problem of removing subdirectory of a directory
I find out cannot remove the directory that contain file and another subdirectory by using command
rmdir -f dir_name
so, everytime i hv to clear out the content of directory in order to delete the directory. So, anyone can teach me how to solve this problem? thanks~
November 20th, 2003, 12:42 PM
rm has this option. See man rm for all options
rm -rf dir_name
-r, -R, --recursive
remove the contents of directories recursively
ignore nonexistent files, never prompt
A warning: linux (and unix) are relentless, they do what you ask and don'y ask if you are sure!
November 20th, 2003, 07:35 PM
druuna, thanks again~
I am a beginner of Unix OS, so i still not familiar with those command..
By the way, u r a very good tutor for me~ Have a nice day!
December 7th, 2003, 12:28 AM
One small addition, You need to use "rm -rf" cautiously, if you tend to give "rm -rRf" * then the whole of the files from the root directory will be gets deleted. You better give rm -ri rather than rm -rf
-i option will ask for confirmation before deleting the files
December 7th, 2003, 02:09 AM
It will ask for confirmation if you don't include -i or -f. If you know what you are doing, -f is a better solution especially if you have a lot of files, as it would be very annoying to have to say yes many times needlesly.