"Each directory has multiple image files in it. I need to manipulate them by naming the first one default.jpg and give the rest different names. I've got my script to the point where it lists the directory and each file in it, however, I think theres something missing in my logic so that i can manipulate the first one one way and the rest another way. Here is my info" #!/bin/bash DIRECTORY_INDEX=`ls -F /www/htdocs/mpb/html/prod_img/` for x in $DIRECTORY_INDEX; do LIST=`ls -F /www/htdocs/mpb/html/prod_img/${x}` for FILE in $LIST; do DIR=`echo /www/htdocs/mpb/html/prod_img/${x}`; # If "_d" does not exist within the string $FILE then: if [[ $FILE != *_d* ]] && [[ $FILE != *_t* ]] then echo "Dir = $DIR" echo "File = $FILE" fi done done ~~~~~~~~~~ Output: ~~~~~~~~~~ Dir = /www/htdocs/mpb/html/prod_img/1241/ File = SCMICRO!SILVE-941443.jpg Dir = /www/htdocs/mpb/html/prod_img/1241/ File = SCMICRO!SILVE-941444.bmp Dir = /www/htdocs/mpb/html/prod_img/1241/ File = SCMICRO!SILVE-941445.jpg