I'm finding that some find commands I enter, ignore a lot of files, and only seem to work properly* if I do not pass an action at the end of the command.
I will use the following command as the base for this question:
find . -depth -name '*.elf' -or -name '*.exe'
Real example:
find . -depth -name '*.elf' -or -name '*.exe' -or -name 'f*.xml' -or -name '*.html' -or -name '*.jar' -or -name '*.mat' -or -name '*.pyc' -or -name '*_dll' -or -name '*.class' -or -name '*.DS_Store' -or -name '*.dll' -or -name '*.dex'
The base command on its own gives plenty of output, but the following command does nothing*:
find . -depth -name '*.elf' -or -name '*.exe' -delete
Similarly, this command, though it should be identical to the base command, gives no output*:
find . -depth -name '*.elf' -or -name '*.exe' -print
Or even*:
find . -depth -name '*.elf' -or -name '*.exe' -exec echo {} \;
Am I missing something about how find works?
I'm using GNU find version 4.8.0.
*By "work properly", I mean that if I run the base command, I will find all matching files, but with any explicit action, only some consistent subset will be found. This means that if I pass -delete
, that subset will be gone, and no explicit actions will find any of the remaining files. Reverting to the base command will find them again.