Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
find -exec <?>
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
glurps
Apprentice
Apprentice


Joined: 11 Mar 2004
Posts: 292

PostPosted: Fri Sep 03, 2004 1:33 pm    Post subject: find -exec <?> Reply with quote

Code:
/usr/mp3 jrb$ find /usr/mp3/test/ -type f -name '.*' -exec rm {}\; 
find: missing argument to `-exec'
/usr/mp3 jrb$ find /usr/mp3/test/ -type f -name '.*' -exec rm \{\}\;
find: missing argument to `-exec'


what am i doing wrong?
Back to top
View user's profile Send private message
hjnenc
Veteran
Veteran


Joined: 15 Aug 2004
Posts: 1599
Location: Vienna, Austria

PostPosted: Fri Sep 03, 2004 1:41 pm    Post subject: Reply with quote

leave a space between } and \;
Back to top
View user's profile Send private message
glurps
Apprentice
Apprentice


Joined: 11 Mar 2004
Posts: 292

PostPosted: Fri Sep 03, 2004 2:18 pm    Post subject: Reply with quote

thx
Back to top
View user's profile Send private message
oberyno
Guru
Guru


Joined: 15 Feb 2004
Posts: 467
Location: /bin/zsh

PostPosted: Fri Sep 03, 2004 3:27 pm    Post subject: Reply with quote

In zsh you could just do this:
Code:
rm /usr/mp3/test/*(.)

The (.) is a glob qualifier for regular files.
Back to top
View user's profile Send private message
glurps
Apprentice
Apprentice


Joined: 11 Mar 2004
Posts: 292

PostPosted: Sun Sep 05, 2004 12:00 pm    Post subject: Reply with quote

i don't think this would remove files from any subfolders, then again i only know bash.
Back to top
View user's profile Send private message
oberyno
Guru
Guru


Joined: 15 Feb 2004
Posts: 467
Location: /bin/zsh

PostPosted: Sun Sep 05, 2004 1:20 pm    Post subject: Reply with quote

Right, it would only remove things in the current directory. In zsh you can use ** to search recursively.
Code:
rm /usr/mp3/test/**/*(.)
Use *** to search across symlinks.

Edit: Add a . before the last * to remove all files that start with a dot as per your example.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum