LinuxQuestions.org
Register a domain and help support LQ
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-31-2002, 02:54 PM   #1
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Rep: Reputation: 15
How can I delete a directory and its files?


I would like to delete a directory and all of its subdirectories and files in one command, can anyone tell me how to do this?
 
Old 08-31-2002, 03:10 PM   #2
MartBrooks
Member
 
Registered: May 2002
Location: London
Distribution: Debian
Posts: 388

Rep: Reputation: 31
rm -rf <directory>
 
Old 08-31-2002, 03:36 PM   #3
Bert
Senior Member
 
Registered: Jul 2001
Location: 406292E 290755N
Distribution: GNU/Linux Slackware 8.1, Redhat 8.0, LFS 4.0
Posts: 1,004

Rep: Reputation: 46
When you are root, make sure that there is no space between your slash and the directory:

rm -rf / <directory>

or bad things will happen.

I'd use

rm -rf <TAB>

for a list of options.
 
Old 08-31-2002, 11:10 PM   #4
ShawnD
Member
 
Registered: Jul 2002
Distribution: Mandrake 8.2
Posts: 127

Rep: Reputation: 15
great warning

what does the f mean? r means to include all subfolders right?
 
Old 08-31-2002, 11:59 PM   #5
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Don't prompt, in other words, every file would go through and ask you if you are sure, this way, it will just remove it.
 
Old 09-01-2002, 01:52 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
Originally posted by ShawnD
great warning

what does the f mean? r means to include all subfolders right?
r means recursive
f stands for force

Last edited by trickykid; 09-01-2002 at 01:53 AM.
 
Old 09-01-2002, 04:25 AM   #7
tundra
Member
 
Registered: Jun 2002
Location: Koom Valley
Distribution: rh8
Posts: 528

Rep: Reputation: 31
check out the man pages for more information. at the prompt, type:
man rm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Script to delete files with 0k file size in a directory justgiver Linux - Newbie 4 01-28-2008 04:56 AM
shell script: delete all directories named directory.# except directory.N brian0918 Programming 3 07-13-2005 06:54 PM
Auto Delete oldest files @ratex when directory is 98% full jmanjohn61 Linux - Software 1 04-05-2005 03:44 PM
rm can't delete 999999 files in one directory yelo Linux - Software 10 04-10-2004 02:00 PM
How do you delete a directory? R4z0r Linux - Newbie 1 12-25-2002 11:16 AM


All times are GMT -5. The time now is 06:31 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration