On Wed, Feb 20, 2008 at 2:42 PM, Natan Shar <[EMAIL PROTECTED]> wrote:
>  I can do this with a few id numbers using php, but I need to do this with
>  thousands of id numbers on a daily basis using a cron job
>
>  I can successully build an array of the filenames using:
>  declare -a imagelist='ls www/images/124534_*.JPG';
>
>  But then I am stuck with the problem of srtipping the 'www/images/' off of
>  each array element. I am trying:
>   for file in [EMAIL PROTECTED]
>   do
>   declare newfile=echo $file | sed 's/www\/images\///g'
>   echo $newfile
>   done;

More complicated than it needs to be.

ITEM=124534
imagelist=`cd www/images; echo $ITEM_*.JPG`
if [ "$imagelist" = "$ITEM_*.JPG" ]; then imagelist=""; fi
imagelist="${imagelist// /,}"

Nothing but builtins.

Dave


Reply via email to