On Mon, Jun 14, 1999 at 11:59:26AM -0400, Arcady Genkin wrote > Hi all: > > How would I enter a command (or write a simple script) that would do: > > FOR EACH FILE *.elc IF THERE IS CORRESPONDING *.el, DELETE IT > > Are there any good online resources about writing similar scripts? >
I'm assuming you want to delete the "*.elc" files if you have the source, and not the other way around. Equivalent but simpler to script: FOR EACH FILE_a *.el IF THERE IS CORRESPONDING FILE_b *.elc, DELETE FILE_b One-liner, from the base of the directory tree you want to search: find . -name "*.el" -exec rm \{\}c \; Easier to type, much less efficient if there are a large number of *.el without matching *.elc. For that case, you can use: find . -name "*.el" -printf "test -f %pc && rm %pc" | /bin/sh which has the added benefit of not spitting out an error message for each missing .elc file. To confirm what it will do, issue the command without the '| /bin/sh' first. John P. -- [EMAIL PROTECTED] [EMAIL PROTECTED] "Oh - I - you know - my job is to fear everything." - Bill Gates in Denmark