LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-16-2004, 08:37 AM   #1
tolstyi
Member
 
Registered: Oct 2004
Posts: 65

Rep: Reputation: 15
Removing non empty directiories


I untarred source code which created a directory with a large number of subdiretories with files in them. Now I don't need this directory anymore and I'd like to remove it.

I know

rmdir

will remove an empty directory, but won't touch it if there are other directories with files in it. Is there an easy way of removing the main directory with non-empty subdirectories in one or two easy commands, or am I stuck removing each file individually? Thanks
 
Old 11-16-2004, 08:40 AM   #2
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
rm -rf

[edit]
... the classic quote 'rm -rf /' = NEVER DO

=remove -recursivly, force (don't prompt)
[/edit]

Last edited by secesh; 11-16-2004 at 08:42 AM.
 
Old 11-16-2004, 09:25 AM   #3
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
My favorite way to do this (and I do it a lot!) is to use Midnight Commander ("mc"), the file manager, probably either installed on your system or available for it.

It lets you see what you're dealing with and gives you a dialog box where you can choose to delete recursively or not.

Very, very handy. OK, it amounts to a GUI, but I think there are times when that's better than the command line. Just my preference.
 
Old 11-16-2004, 11:10 AM   #4
Kreature
LQ Newbie
 
Registered: Nov 2004
Posts: 20

Rep: Reputation: 0
I like to rm -rf / all the time just for kicks!!!!!

 
Old 11-16-2004, 11:23 AM   #5
tenmiles
Member
 
Registered: Nov 2004
Distribution: fedora core 3
Posts: 43

Rep: Reputation: 15
i use fedora core 1 and i tried to delete /mnt/fat32 so i did rm /mnt/fat32 and nothing. so i looked it up in my handy dandy linux+ cert prep book (it is what i use as a guide book) and i found that it wants you to use the rmdir command. so try that and see if it helps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing non-empty directory satimis Linux From Scratch 5 03-09-2009 04:58 AM
Gentoo VNC, empty dialog box !! "Question" window is empty ! TheHushedCaskeT Linux - Software 0 02-01-2005 10:14 PM
How can I tell if a partition is empty? PenguinMolester Linux - Newbie 5 10-27-2004 07:46 AM
Removing files wihtout removing containing Direcotry caps_phisto Linux - General 2 10-07-2004 08:16 AM
Removing non-empty directories brunnopessoa Linux - Newbie 8 11-13-2003 07:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration