bash:files:list_files_excluding_some_files
This is an old revision of the document!
BASH - Files - List files excluding some files
Without enabled globbing files can be excluded by the second command of this code section:
# See all files ending in .html ls | grep "\.html$" # see all files not ending in .html ls | grep -v "\.html$"
If extended globbing is turned on, one should be able to execute
printf "%s\n" *!(.html)
in ksh and bash but I wasn't. I have this command from a forum so there's a chance that either my shell isn't working properly or the syntax has changed in the meantime.
In zsh you enable globbing by inserting setopt extendedglob in .zshrc
In the zsh this should work
ls path/*!(.html)
but I get zsh: number expected.
Even though it's not working yet it's worth to add these commands to this list as the issue can be fixed by reading some more documentation like this one or this one. At the moment I have no time to continue fixing.
bash/files/list_files_excluding_some_files.1611663301.txt.gz · Last modified: 2021/01/26 12:15 by peter