On Saturday 04 October 2003 03.00, Bruce Marshall wrote:
#!/bin/sh
######################################################################### # A simple script to create smaller and lower quality images from # one directory to another #########################################################################
# The file format you wish to change FROM=jpg
# The end result file format TO=jpg
This is never used
# Options for "convert" CONVERT_OPTIONS='-quality 70 -geometry 640x480'
# Pull the directory name for the title FROM_DIR=/pictures/picdirectory TO_DIR=/home/userid/smallpics
######################################################################### # The actual conversion stuff # You can edit stuff below here to change how this works, or just stick # with the variables above (which should be good for most people #########################################################################
echo Running $0 echo
COUNT=0
for i in `ls $FROM_DIR/*.$FROM | cut -d / -f 4`;
This won't work in a generic way, the 4 can't be hard coded. something like cd $FROM_DIR for i in *.$FROM; do
do
echo $1 if [ ! -e "$TO_DIR/$i" ] # Process only files not already done then echo Converting $i... with $CONVERT_OPTIONS convert $CONVERT_OPTIONS $FROM_DIR/$i $TO_DIR/$i
Something like convert $CONVERT_OPTIONS $FROM_DIR/$i $TO_DIR/${i%%$FROM}$TO perhaps?