Answers for "bash ls without substring"

0

bash ls without substring

# Note: there isn't an ls command specifically, BUT:
# you could use the 'find' command instead

# syntax ("!" is the entry for not)
find *</path/to/folder> ! -name '*<substring to exclude>'

# example
find /jacquesk/home/RandomFiles ! -name '*ExcludeFile*.txt'

# This will list all the files in the current directory 
# of "/jacquesk/home/RandomFiles" that does NOT contain 
# "ExcludeFile" (anywhere in the string) AND do not end in ".txt"
Posted by: Guest on May-04-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language