takayuki
July 30th, 2010, 02:21 AM
Hi,
trying to create a bash script that will shrink jpegs that are larger than 50kb in a directory on my server.
Here's what I've got so far, very early in the process...
the if line errors out with a "command not found". oops.
anyone have any thoughts here for the noob bash scripter?
thanks :)
for FILENAME in *.jpg #traverse filenames...
do
FILESIZE=$(stat -c%s "$FILENAME")
if ["$FILESIZE" > 50000]
then
echo "$FILENAME is too large = $FILESIZE bytes."
fi
done
exit 0
trying to create a bash script that will shrink jpegs that are larger than 50kb in a directory on my server.
Here's what I've got so far, very early in the process...
the if line errors out with a "command not found". oops.
anyone have any thoughts here for the noob bash scripter?
thanks :)
for FILENAME in *.jpg #traverse filenames...
do
FILESIZE=$(stat -c%s "$FILENAME")
if ["$FILESIZE" > 50000]
then
echo "$FILENAME is too large = $FILESIZE bytes."
fi
done
exit 0