deleting directory w/o descending
how do i delete a directory without descending and having to delete every content inside. i tried doing 'prompt' and 'rm -r' but to no avail.
thanks:study: |
you can add a f to rm -r becoming rm -rf
|
It is weird that rm -r does not just work, as newinlinux said try with rm -rf
|
Make SURE you type that in right, especially if you are root. It does not ask questions about what you are doing.
I had moved my Gentoo to a new hard drive and I booted the old drive and typed in rm -rf /* just to see what it would do. It ran until it deleted something that it needed then errored out. About 90% of the files were gone, I think it was something in /usr/sbin. Trust me, it will delete what you tell it, even if you tell it wrong. :tisk: Later :D :D :D :D |
<info>
some distros do an alias rm="rm -i" as default, for new users coming from windows... normally these are in /etc/tcshrc.alias or /etc/profile or /etc/bashrc or whatever shell is in use... </info> |
rm -r alone doesn't work because by default rm doesn't remove directories - only their contents and tells you it can't remove a directory because it is a directory. The -f flag says to disregard all warning conditions and force the remove.
As pointed out by others it is useful for removing an entire directory tree but can be very dangerous if you don't use it correctly. |
All times are GMT -5. The time now is 06:32 PM. |