LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-14-2006, 02:46 PM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Rep: Reputation: 47
How to remove folders


The 'rm' command removes file in Linux.

The 'rmdir' command removes folders in Linux.

I want to know the command which removes folders which are full of files.

How do I remove a folder which has a lot of files and folders?

Because 'rmdir' command complains about the folders which contain files. Then I have to remove those files one by one. That is a tall order.

Your help is appreciated.
 
Old 08-14-2006, 02:49 PM   #2
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
man rm. Read about recusion.
 
Old 08-14-2006, 02:59 PM   #3
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
Thanks Proud
It doesn't tell me how to me remove the directories.
The following information is useless.
------------------------------------

DESCRIPTION
Remove the DIRECTORY(ies), if they are empty.

--ignore-fail-on-non-empty

ignore each failure that is solely because a directory is non-
empty

-p, --parents
remove DIRECTORY, then try to remove each directory component of
that path name. E.g., `rmdir -p a/b/c' is similar to `rmdir
a/b/c a/b a'.

-v, --verbose
output a diagnostic for every directory processed

--help display this help and exit

--version
output version information and exit

AUTHOR
Written by David MacKenzie.
 
Old 08-14-2006, 03:02 PM   #4
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
I was sure rm -rf will delete a directory and all its contents.

If you want to use rmdir, surely that --ignore-fail-on-non-empty flag would help?
 
Old 08-14-2006, 03:05 PM   #5
a.malich
LQ Newbie
 
Registered: Aug 2006
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
Hi,
Code:
rm -r directory_you_want_to_remove
[EDIT] I was late I may be wrong but I think that rm -r somedirectory _sometimes_ leaves somedirectory untouched? Seems weird but I think something like that happened to me once or twice.

a.malich

Last edited by a.malich; 08-14-2006 at 03:10 PM.
 
Old 08-14-2006, 06:25 PM   #6
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Rep: Reputation: 15
rm -Rf dirname
 
Old 08-15-2006, 02:53 AM   #7
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
Thanks everybody for helping me.

rm -Rf name_of_the_directory. [ This worked fine.]
 
Old 08-15-2006, 01:31 PM   #8
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
symlinks from folders to folders? vbsaltydog Linux - Newbie 4 04-03-2006 01:51 PM
Samba can create new files and folders but access denied in any new folders k.king Linux - Networking 2 01-15-2006 06:14 AM
need a perl script to remove folders cccc Programming 5 03-12-2004 02:39 AM
unable to remove files/folders timsch75 Linux - Software 2 03-01-2004 11:01 AM
How to remove sites once you have put them into folders Silverw0lf Linux - Newbie 1 10-18-2003 01:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:33 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