Westerberg
October 22nd, 2007, 07:50 PM
From the bash man pages:
Composite patterns may be formed using one or more of the following sub-patterns:
. . .
!(pattern-list)
Matches anything except one of the given patterns
In other words, you can include all patterns except the few you want to exclude.
E.g., in a directory containing a mix of .html, .pdf, .avi, and .txt files, you should be able to delete all files except *html by entering:
james@james-desktop:~/Documents$ rm !(*html)
bash: !: event not found
Anyone know what's going on?
Composite patterns may be formed using one or more of the following sub-patterns:
. . .
!(pattern-list)
Matches anything except one of the given patterns
In other words, you can include all patterns except the few you want to exclude.
E.g., in a directory containing a mix of .html, .pdf, .avi, and .txt files, you should be able to delete all files except *html by entering:
james@james-desktop:~/Documents$ rm !(*html)
bash: !: event not found
Anyone know what's going on?