LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-15-2006, 05:40 AM   #1
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Rep: Reputation: 15
rm and recursive deletion


Hi

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?

Thanks
 
Old 02-15-2006, 06:02 AM   #2
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
maybe you want
find .. -exec
example:
http://www.athabascau.ca/html/depts/...HOWTO/find.htm

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

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

Rep: Reputation: 15
try

rm -rf *.o
 
Old 02-15-2006, 07:58 AM   #4
muha
Member
 
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
Code:
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 03:12 AM.
 
  


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 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 05:52 AM
deletion cerin MEPIS 3 12-04-2005 03:38 PM
File Deletion mhkhalqani Linux - General 1 10-12-2005 03:08 AM
deletion of a partition newusermike Linux - Newbie 1 09-29-2005 08:06 PM
lilo deletion Jeepee Linux - Newbie 6 07-08-2002 12:50 PM


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

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