PDA

View Full Version : [SOLVED] how to remove a DIR



bj218
July 14th, 2010, 07:30 PM
How do I remove a Directory? I have a dir. called "home.bak" that I want to remove It is located "/home/home.bak/bill!!

root@bill-desktop:/home/bill# rmdir /home/home.bak/bill
rmdir: failed to remove `/home/home.bak/bill': Directory not empty
root@bill-desktop:/home/bill# rmdir --ignore-fail-on-non-empty /home/home.bak/bill
root@bill-desktop:/home/bill#

darolu
July 14th, 2010, 07:32 PM
Try with:

$ rm -rf /home/home.bak/bill
Be careful, it's a powerful command, "-r" stands for "recursive" so it will remove the directories and their contents recursively; "-f" stands for "force", it will ignore nonexistent files and won't prompt.

By the way, it is not wise nor recommended to be doing stuff as root; use sudo always.

nmaster
July 14th, 2010, 07:32 PM
rm -rf /home/home.bak/bill

KdotJ
July 14th, 2010, 08:56 PM
Use this command very carefully! Be careful not to add extra spaces in it by mistake

The Cog
July 14th, 2010, 08:59 PM
If the directory is empty, rmdir home.bak would do it. That's safer than rm -rf because it refuses if the directory is not empty, but it's also much less useful for the same reason.

bj218
July 14th, 2010, 09:09 PM
This worked just greate THANK YOU. I will also take your advice & use sudo in the future.

Ctrl-Alt-F1
July 14th, 2010, 09:14 PM
By the way, it is not wise nor recommended to be doing stuff as root; use sudo always.
Debatable, but according to the Ubuntu philosophy this is correct. For the beginner this is true mostly because sudo will timeout.

philinux
July 14th, 2010, 09:14 PM
This worked just greate THANK YOU. I will also take your advice & use sudo in the future.

Using sudo is just the same. Be very careful with that command you can nuke your system. Much safer to instal nautilus-gksu and use nautilus itself.