Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Recursively delete executable files [solved]
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
EnlightedGnome
Tux's lil' helper
Tux's lil' helper


Joined: 07 Jun 2005
Posts: 126
Location: Denmark, Odense

PostPosted: Sat Aug 27, 2005 4:49 pm    Post subject: Recursively delete executable files [solved] Reply with quote

How can I recursively delete all executable files in a given folder?
_________________
checking for -lifesign in -Kenny... no
- oh my god, they killed Kenny


Last edited by EnlightedGnome on Sat Aug 27, 2005 8:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
marvin5
Apprentice
Apprentice


Joined: 19 Mar 2005
Posts: 162
Location: Germany

PostPosted: Sat Aug 27, 2005 4:55 pm    Post subject: Reply with quote

Use find -perm (check man find for details)

-- marvin
Back to top
View user's profile Send private message
frenkel
Veteran
Veteran


Joined: 13 May 2003
Posts: 1034
Location: .nl

PostPosted: Sat Aug 27, 2005 4:58 pm    Post subject: Reply with quote

$ man find
<snip>
Code:

       -perm mode
              File's permission bits are exactly  mode  (octal  or  symbolic).
              Symbolic modes use mode 0 as a point of departure.

       -perm -mode
              All of the permission bits mode are set for the file.

       -perm +mode
              Any of the permission bits mode are set for the file.

<snip>
Code:

       -exec command ;
              Execute  command;  true  if 0 status is returned.  All following
              arguments to find are taken to be arguments to the command until
              an  argument  consisting of `;' is encountered.  The string `{}'
              is replaced by the current file name being processed  everywhere
              it occurs in the arguments to the command, not just in arguments
              where it is alone, as in some versions of find.  Both  of  these
              constructions might need to be escaped (with a `\') or quoted to
              protect them from expansion by the shell.  The command  is  exe-
              cuted in the starting directory.
Back to top
View user's profile Send private message
EnlightedGnome
Tux's lil' helper
Tux's lil' helper


Joined: 07 Jun 2005
Posts: 126
Location: Denmark, Odense

PostPosted: Sat Aug 27, 2005 6:28 pm    Post subject: Reply with quote

so something like
find path -perm +0001 -exec rm {} \;
will work?
_________________
checking for -lifesign in -Kenny... no
- oh my god, they killed Kenny
Back to top
View user's profile Send private message
frenkel
Veteran
Veteran


Joined: 13 May 2003
Posts: 1034
Location: .nl

PostPosted: Sat Aug 27, 2005 8:39 pm    Post subject: Reply with quote

Test it in a directory with some test data.
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