Barriehie
June 10th, 2008, 01:57 AM
I've looked at this for hours and can't find it!!! Can anyone please tell me why my LoopCounter isn't incrementing??? At least it appears to not be. When I run this I only get a directory listing consistent with dirr[0].
Thank You,
Barrie
It's BASH and not PHP / First time around I'm just ls'ing the files and not rm'ing them.
I read the FAQ. :)
#!/bin/bash
#
# Recourse through .thumbnail folder and sub-folders removing the .png files.
#
#
# Define variables
#
dirr[0]="/home/barrie/.thumbnails/normal/*.png"
dirr[1]="/home/barrie/.thumbnails/large/*.png"
dirr[2]="/home/barrie/.thumbnails/fail/gnome-thumbnail-factory/*.png"
dirr[3]="/home/barrie/.thumbnails/fail/gqview-1.0/*.png"
dirr[4]="/home/barrie/.thumbnails/fail/thunar-vfs/*.png"
LIMIT=5
LoopCounter=0
#
# Loop through dirr[array] and delete the thumbnails
#
while [ "$LoopCounter" -lt "$LIMIT" ]
do
#
# Get the recursion to work then we'll rm the files.
#
ls -c ${dirr[$(LoopCounter)]}
let "loopcounter += 1"
done
#
# Bye
#
exit 0
Thank You,
Barrie
It's BASH and not PHP / First time around I'm just ls'ing the files and not rm'ing them.
I read the FAQ. :)
#!/bin/bash
#
# Recourse through .thumbnail folder and sub-folders removing the .png files.
#
#
# Define variables
#
dirr[0]="/home/barrie/.thumbnails/normal/*.png"
dirr[1]="/home/barrie/.thumbnails/large/*.png"
dirr[2]="/home/barrie/.thumbnails/fail/gnome-thumbnail-factory/*.png"
dirr[3]="/home/barrie/.thumbnails/fail/gqview-1.0/*.png"
dirr[4]="/home/barrie/.thumbnails/fail/thunar-vfs/*.png"
LIMIT=5
LoopCounter=0
#
# Loop through dirr[array] and delete the thumbnails
#
while [ "$LoopCounter" -lt "$LIMIT" ]
do
#
# Get the recursion to work then we'll rm the files.
#
ls -c ${dirr[$(LoopCounter)]}
let "loopcounter += 1"
done
#
# Bye
#
exit 0