How to get files without certain strings in their files names (reverse of *string*) on Linux?
Posted on In QATo get files with certain string in their file names, it is quite straightforward:
ls *string*
However, how to do the reverse one: how to get files without certain strings in their files names on Linux?
You can get a list of file names by a combination of find
and xargs
as follows:
find . ! -name '.' -and ! -name '*string*' | xargs
or by ls
and grep
as follows:
ls | grep -v string | xargs