I try to filter some files I don't want to copy to another folder (a123*.zip
in this case) and want to copy all other *.zip
files
if [[ ! -f ./a123*.zip ]];
then
# copy all files without a123*.zip
fi
How do I trigger the copy?
I try to filter some files I don't want to copy to another folder (a123*.zip
in this case) and want to copy all other *.zip
files
if [[ ! -f ./a123*.zip ]];
then
# copy all files without a123*.zip
fi
How do I trigger the copy?
You can use extglob
here:
shopt -s extglob
cp !(a123*.zip) /destination
If you want to copy all *.zip
files except a123*.zip
then use: (thanks @kojiro)
cp !(a123*).zip /destination
find . -maxdepth 1 -type f -and name \*.zip -not -name a123\*.zip -exec cp "{}" "$destination"