LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-25-2006, 08:04 PM   #1
O(V)eGA_l2el)
Member
 
Registered: May 2005
Distribution: Fedora & Debian
Posts: 56

Rep: Reputation: 15
find & rm commands


I am using Fedora Core 4 (2.6.17-1.2142_FC4) and want to know the proper command syntax to find and remove files with certain names without prompting for "yes" before the "rm" command is executed. For example, below is the proper syntax for finding all files with "(E)," w/o quotations, in the file name and removing said files (after prompting for "y").

find . -name '*(E)*' -ok rm {} \;
< rm ... ./file(E)name.extension > ?

Once above is shown, I press "y" then "Enter." Excellent this works, but I do not want to be prompted for hundreds of files in the current directory. What do I need to change in the above find command syntax to make the removal of all specific files automatic?
 
Old 08-25-2006, 08:08 PM   #2
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
try using rm -r
 
Old 08-25-2006, 08:09 PM   #3
AAnarchYY
Member
 
Registered: Sep 2004
Location: Carlisle, MA
Distribution: Slackware 10.2 Fluxbox 2.6.17.6
Posts: 419

Rep: Reputation: 30
rm -r is recursive
rm -f is force
from your example you most likely want rm -rf

Last edited by AAnarchYY; 08-25-2006 at 08:11 PM.
 
Old 08-25-2006, 08:09 PM   #4
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
rm doesn't prompt by default (man rm). You probably have an alias somewhere that says rm='rm -i'. The most likely places are ~/.bashrc, ~/.bash_profile, /etc/profile, or /etc/bash.bashrc.

Happy hunting!
 
Old 08-25-2006, 08:35 PM   #5
O(V)eGA_l2el)
Member
 
Registered: May 2005
Distribution: Fedora & Debian
Posts: 56

Original Poster
Rep: Reputation: 15
Yes, I understand all of your responses, but how can I make that work with the "find" command syntax below. What do I need to add without using the "-ok" option?

find . -name '*(E)*' -ok rm {} \;
 
Old 08-25-2006, 08:44 PM   #6
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
as said
Quote:
rm='rm -i'. The most likely places are ~/.bashrc, ~/.bash_profile, /etc/profile, or /etc/bash.bashrc.
just go there and delete the line which has an alias for rm which says something like rm='rm -i'
 
Old 08-26-2006, 09:16 AM   #7
O(V)eGA_l2el)
Member
 
Registered: May 2005
Distribution: Fedora & Debian
Posts: 56

Original Poster
Rep: Reputation: 15
Ok, I forgot about the parenthesis. Syntax was changed to the following (which works perfectly):

rm -v *'(E)'*
 
  


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
how can I execute two commands on exec of a find? eantoranz Programming 3 08-03-2010 05:51 PM
How to execute multiple commands with find and -exec... tomstratton Linux - General 6 05-26-2009 04:26 AM
diff in && ; ;; commands ? name_in_use450 Linux - Newbie 2 06-11-2004 11:20 AM
Console commands && GUI DaFrEQ Programming 10 05-29-2003 01:00 PM
Cannot find reliable information on shell commands Rakin Linux - Newbie 7 02-21-2003 11:55 AM


All times are GMT -5. The time now is 09:04 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration