On Mon, 4 Nov 2002 18:46:33 -0500
Todd Slater <[EMAIL PROTECTED]> wrote:
> Here's a script I wrote--I call it mover.sh, but call it what you like.
> It will make subdirectories inside a directory full of images, and move
> 20 images to each subdirectory.
Duh, had a typo--forgot to close a quote. Here it is again.
#!/bin/bash
# SET UP VARIABLES
ImageCount=1
FolderCount=1
FolderName="test"
MYPATH="/home/todd/fuji/keep"
TARGET="$MYPATH/$FolderName-$FolderCount"
# NO MORE VARIABLES TO SET UP
while [ -d $TARGET ] ; do
echo "Target directory exists"
FolderCount=$(($FolderCount+1))
echo "Target directory is now $FolderCount"
TARGET=`echo $TARGET | awk -F'-' '{print $1}'`-$FolderCount
done
mkdir $TARGET
for file in `find $MYPATH -maxdepth 1 -type f -iname '*.jpg'`
do
if [ $ImageCount -gt 20 ] ; then
ImageCount=1
FolderCount=$(($FolderCount+1))
mkdir $MYPATH/$FolderName-$FolderCount
fi
mv $file $MYPATH/$FolderName-$FolderCount
ImageCount=$(($ImageCount+1))
done
echo "Done"
exit
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com