LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find trouble (https://www.linuxquestions.org/questions/linux-newbie-8/find-trouble-345244/)

chandru.in 07-21-2005 12:22 AM

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".

Michael Johnson 07-21-2005 02:14 AM

Try this syntax
find . -name *~ -exec rm '{}' \;
NOTE the single quotes.

chandru.in 07-21-2005 06:03 AM

I'm sorry!

That did not help!!

jkobrien 07-21-2005 06:32 AM

Double quotes around *~, I think.

I.e.

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

John

chandru.in 07-21-2005 06:39 AM

Thanks!

That worked out. But y do I need the double quotes when there are no spaces in the file names?

jkobrien 07-21-2005 06:46 AM

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

John

chandru.in 07-21-2005 07:10 AM

Thanks for the explanation


All times are GMT -5. The time now is 02:51 PM.