rm all executables
Hi all
I move some source code from an SGI to the PowerBook. Now I need to compile but all the old object files and executables are still there. What's the trick to delete all files that are set to execute? I looked in the rm and find man pages to see if there was a way to filter on mode but I don't see it.
Any help?
I move some source code from an SGI to the PowerBook. Now I need to compile but all the old object files and executables are still there. What's the trick to delete all files that are set to execute? I looked in the rm and find man pages to see if there was a way to filter on mode but I don't see it.
Any help?
Comments
find -perm ought to do it.
Basically this command will list all the files that are executables in a given directory:
ls -al | egrep "^-..x"
This one will do the same, but only print the files name:
ls -al | egrep "^-..x" | awk '{ print $9 }'
So in a shell script, do a loop that iterates through each line (which is actually each file name) and issues the rm command on that files name based on the output from the above command.
If I could remember the "for" syntax in shell scripting I'd do it for you...but its been awhile.