I'm trying to set up an sh
script that will run every 30 minutes. During each run, I want to check a directory for the presence of at least one .RAW file. Upon finding that file extension, I will have other code to execute, but right now I'm having trouble figuring out the correct if statement to use.
I know this code example isn't the most ideal way to do it, but here's the code I tried which is obviously wrong:
cd ./dir/
if [ ! -f "*.RAW"]; then
echo "No files!"
else
echo "Yes files!"
fi
How can I correctly test for the presence of the .RAW extension?
bash
specific): Test if there are files matching a pattern in bash – Stéphane Chazelas Aug 22 '15 at 18:09