Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-15-2006, 06:40 AM   #1
Registered: Dec 2005
Posts: 76

Rep: Reputation: 15
rm and recursive deletion


I have many files ending .o in a variety of subdirectories which I wish to delete in one go. The recursive delete on the parent directory does not delete those in the subdirectory. I am trying rm -r *.o Is there a way to do this or should I use grep and pipe the results?

Old 02-15-2006, 07:02 AM   #2
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
maybe you want
find .. -exec

try the option with -print first, to see what you are about to delete ..

Last edited by muha; 02-15-2006 at 07:04 AM.
Old 02-15-2006, 08:23 AM   #3
Registered: Aug 2004
Location: bangalore
Distribution: Redhat,Ubuntu
Posts: 64

Rep: Reputation: 15

rm -rf *.o
Old 02-15-2006, 08:58 AM   #4
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
@sohny: why does adding the --force option cause rm to recurse in lower directories if the previous rm -r *.o did not?

@disruptive: what do you get from this
ls -r *.o
then rm -r *.o
should work nicely to delete the file you got from the ls command.

You might want to add the -i option to rm to check what you are deleting. So:
rm -ir *.o

Last edited by muha; 02-17-2006 at 04:12 AM.


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
deletion of a recursive directory? captainnico Linux - Software 9 02-04-2006 06:52 AM
deletion cerin MEPIS 3 12-04-2005 04:38 PM
File Deletion mhkhalqani Linux - General 1 10-12-2005 04:08 AM
deletion of a partition newusermike Linux - Newbie 1 09-29-2005 09:06 PM
lilo deletion Jeepee Linux - Newbie 6 07-08-2002 01:50 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration