How do you assign a variable to be a variable file name in a directory?
I'm running Hylafax and receiving upwards of 1000 faxes daily. Sometimes I will receive partial pages that are less than 10k in
size. What I'm trying to do is ignore those and copy the ones larger than 10k into my faxes directory.
Here's my basic script so far.
#!/bin/bash
file="fax000038578.tif"
declare -i fsize
fsize=$(stat -c %s "$file")
if [ "$fsize" -gt 10000 ]
then
cp $file /home/user/faxes
fi
It works fine if I name the specific file as shown above. However, the file names change each time a fax is received. They will always have the tif extension. The number associated to the fax (000038578) does not always increase incrementally though.
I tried file="*.tif" but that didn't work. Stat returned no such file error.
So basically, I need file to be a variable with a variable file name with a tif extension inside it.
Thanks in advance
David Elliott
|