View Full Version : How do You delete a Directory and all it's contents?
FishTech
11-01-02, 12:14 PM
Hi All!:)
How do You delete a Directory and all it's contents?
Thanks and Love You!
FishTech
rm -rf /somedirectory
be careful :)
FishTech
11-01-02, 01:59 PM
Thanks DaveW,
I tried it but it didn't work?... I'm using Mandrake 9.0 if that makes a difference.
Also, as Root/Superuser don't I have the authority to delete any directory or file?... These directorys and files (that are now in the trash) that I'm trying to delete even as Root tell me acess denied... What's up with that?
Dunno... rm -rf is pretty much the only Linux command I know :)
Can anyone else help out here?
rmdir directory/* to get rid of all files and dir
rmdir -rf directory
or try
rmdir -rf directory/*
NOTE:i dont use this to often, it can be risky especially at cmd line level
unix and linux commands are all universal. So if u know unix cmd line scripting u can use that for linux cmd scripting too.
By the way out of curiousity what directory are u nuking?:)
cheers
dexta
Klaus-P
11-01-02, 05:32 PM
" Hi All!
How do You delete a Directory and all it's contents?
Thanks and Love You!"
The "BIBLICAL REVELATION(S)" will LOVE you too while deleting a Directory, i'm almost sure.
(i hope my non-technical remark does not violate any thread 'laws', hmmmm.)
FishTech
11-01-02, 05:32 PM
Hi de><ta, and thanks DaveW,
I tried them all and nothing worked... Am I doing something wrong?... Here's my shell session:
[peacemaker@localhost Trash]$ su
Password:
[root@localhost Trash]# rmdir -rf Kvidtune/*
rmdir: invalid option -- r
Try `rmdir --help' for more information.
[root@localhost Trash]# rmdir -rf Kvidtune
rmdir: invalid option -- r
Try `rmdir --help' for more information.
[root@localhost Trash]# rmdir Kvidtune/*
rmdir: `Kvidtune/kvidtune-0.4.1': Directory not empty
[root@localhost Trash]#
what about 'rm -rf Kvidtune' ?
that will work, the 'r' is for recursively and the 'f'
means force, without 'f' rm can't delete a directory.
cheers
synonymy
11-02-02, 11:56 AM
rm -r nameofdirectory
works for me mdk9.0
synonymy: you're right, should have done some proof reading :)
the 'f' flag is needed incase there is a read-only file, as 'rm' would
choke on it and ask if you were really sure.....
cheers
FishTech
11-04-02, 05:28 PM
Thanks Everyone,
'rm -r' worked... I did however have to answer 'y' for each and every file that I wanted to delete within the directory... Would there be an easier way?
'rm -rf' as I wrote and explained one post above.
or do 'unalias rm', then rm -f will do also :)
I assume it's either RH or MDK? am I right?
cheers
redhat (dunno MDK) set 'rm' to 'rm -i' (I know
not exactly, it's just an alias, but we may keep
that up for further axplanations later on, may we?)
FishTech
11-04-02, 11:48 PM
Thanks Everyone,
I got it now.:)
Thanks for Your Help and Time!
Love You!
FishTech
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.