Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove directory, subdirectory and files

Status
Not open for further replies.

lweng

Technical User
May 18, 2001
113
US
How to remove directories, subdirectories and files together? If I want to remove /abc/efg/xyz/xxx.doc, and there are files and directories under each dir, what command can I use to remove them all at once instead of step by step? Thanks.
 
Use rm command with r and f options but be careful think twice and then press enter go thru the rm man page.
 
I type rm * -r, and got

rm: admin is a directory
rm: bin is a directory
rm: dbs is a directory
rm: install is a directory

If I type rmdir * -r and I got

rmdir: directory "admin": Directory not empty
rmdir: directory "bin": Directory not empty
rmdir: directory "dbs": Directory not empty
rmdir: directory "install": Directory not empty
rmdir: directory "ldap": Directory not empty

How to remove them together? Thanks.
 
You need to put flag options first (r is for recursive remove and f to force removing, without asking.
so you need to type:

# rm -r *

Regards,

Carlos Almeida,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top