I am trying to check if a directory contains at least one .JPG file before running code.
[ -f *.JPG ] && echo "yes"
Will result with the following error:
bash: [: too many arguments
if there are such matching files in that directory.
No error is produced if there are no matching files in the directory.
If a directory contains ONLY .JPG files, the code works, but I need something that will work to find at least one .JPG in a directory full of other file extensions.
Many thanks in advance.
1