nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   General Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=27)
-   -   How do You delete a Directory and all it's contents? (http://www.nvnews.net/vbulletin/showthread.php?t=3531)

FishTech 11-01-02 11:14 AM

How do You delete a Directory and all it's contents?
 
Hi All!:)

How do You delete a Directory and all it's contents?

Thanks and Love You!
FishTech

DaveW 11-01-02 11:26 AM

rm -rf /somedirectory

be careful :)

FishTech 11-01-02 12: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?

DaveW 11-01-02 01:03 PM

Dunno... rm -rf is pretty much the only Linux command I know :)

Can anyone else help out here?

de><ta 11-01-02 03:28 PM

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 04: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 04: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]#

mtrr 11-02-02 10:25 AM

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 10:56 AM

rm -r nameofdirectory

works for me mdk9.0

mtrr 11-02-02 11:10 AM

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 04: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?

mtrr 11-04-02 05:02 PM

'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?)


All times are GMT -5. The time now is 12:16 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.