LinuxQuestions.org
Register a domain and help support LQ
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 07-21-2005, 01:22 AM   #1
chandru.in
Member
 
Registered: Jun 2005
Posts: 167

Rep: Reputation: 30
find trouble


Hi,

I have the following mount structure,

/dev/hdc9 ext3 /
/dev/hdc6 vfat /home/chandru/data

I have two files as below,

/home/chandru/tmpfile~
/home/chandru/data/abc/techo~

from /home/chandru, when I execute,

find . -name *~ -exec rm {} \;

the file "techo~" is not removed, but "tmpfile~" is removed.

However, when I run the same command from the same directory for a second time, "techo~" is removed.

What should I do remove both files simultaneously??

Basically, I want to remove all backup files created by emacs under "/home/chandru".
 
Old 07-21-2005, 03:14 AM   #2
Michael Johnson
Member
 
Registered: Jul 2005
Location: Wagga Wagga, Australia
Posts: 262

Rep: Reputation: 30
Try this syntax
find . -name *~ -exec rm '{}' \;
NOTE the single quotes.
 
Old 07-21-2005, 07:03 AM   #3
chandru.in
Member
 
Registered: Jun 2005
Posts: 167

Original Poster
Rep: Reputation: 30
I'm sorry!

That did not help!!
 
Old 07-21-2005, 07:32 AM   #4
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
Double quotes around *~, I think.

I.e.

find . -name "*~" -exec rm {} \;

John
 
Old 07-21-2005, 07:39 AM   #5
chandru.in
Member
 
Registered: Jun 2005
Posts: 167

Original Poster
Rep: Reputation: 30
Thanks!

That worked out. But y do I need the double quotes when there are no spaces in the file names?
 
Old 07-21-2005, 07:46 AM   #6
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
I think it's the wild-card (*). That expands to a list and how that will be handled depends on your shell.

John
 
Old 07-21-2005, 08:10 AM   #7
chandru.in
Member
 
Registered: Jun 2005
Posts: 167

Original Poster
Rep: Reputation: 30
Thanks for the explanation
 
  


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
having trouble with ls and find finding files. dr_zayus69 Linux - Software 4 05-26-2005 11:36 AM
trouble with find command in bash vrdhananjay Linux - Newbie 3 10-31-2004 12:37 AM
Trouble installing on Compaq Deskpro (Can't find CDrom) akempo Slackware - Installation 15 02-08-2004 10:36 PM
Trouble Invoking JVM From C: Cannot Find libjava.so. eric.r.turner Programming 0 10-20-2003 11:36 PM
trouble pls help BZFlag crashes no error message that I can find Cor_Tauri Linux - Newbie 2 07-15-2001 07:49 PM


All times are GMT -5. The time now is 10:42 AM.

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