So far I see bash, awk, sed, xargs and even ls ... why?
I might not be understanding the actual question here because this is one of those questions where someone says ... I am doing something '
this' way and
want to fix blah to get it to work .... When really you should be telling us what
it is you want to do and then what you have tried. The reason this is different
is it allows helpers to show you that your current method may in fact be the issue as opposed to a single part of it.
I believe this is the case here. From the current explanation, it appears you wish the following:
1. Find all files with a specific name and delete them
2. Exception to rule 1 is that you have a certain path you do not wish to follow
Now you may be doing more processing than this but of course you do not mention it, so the above is a simple find, something along the lines of:
Code:
find /path/to/start -path /path/to/be/excluded -prune -o -type f -name 'specific_file_name_here' -exec echo rm {} \;
If this gives you the output you want then simply remove the echo and rm will remove the chosen files.
If I have completely misunderstood the requirement here please let me know?