yeouuu yeouuu - 6 months ago 11
Linux Question

Find files ending with *.html but not *-partial.html

I'm refactoring some build tasks in my grunt and I'm trying to find a way to search for files ending with

.html
but not
-partial.html


Is there some tool or commandline to find all these files?

Not working example:
find *.html --exclude=*-partial.html

Answer

find supports logical operators, specifically -and and -not, so you could look for all the files that end in .html but do not end in -partial.html:

find . -name "*.html" -and -not -name "*-partial.html"