"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. Note that I need to ignore all of the files with _d and _t which I have already done, but in doing so I think I have confused my logic moving forward."ls -al /www/htdocs/mpb/html/prod_img/1241/-rw-r--r-- 1 root other 114474 Nov 24 17:28 SCMICRO!SILVE-941443.jpg-rw-r--r-- 1 root other 36309 Nov 24 17:28 SCMICRO!SILVE-941443_d.jpg-rw-r--r-- 1 root other 4508 Nov 24 17:28 SCMICRO!SILVE-941443_t.jpg-rw-r--r-- 1 root other 3120054 Nov 24 17:28 SCMICRO!SILVE-941444.bmp-rw-r--r-- 1 root other 270054 Nov 24 17:29 SCMICRO!SILVE-941444_d.bmp-rw-r--r-- 1 root other 17154 Nov 24 17:29 SCMICRO!SILVE-941444_t.bmp-rw-r--r-- 1 root other 118010 Nov 24 17:29 SCMICRO!SILVE-941445.jpg-rw-r--r-- 1 root other 37554 Nov 24 17:29 SCMICRO!SILVE-941445_d.jpg-rw-r--r-- 1 root other 4760 Nov 24 17:29 SCMICRO!SILVE-941445_t.jpg-rw-r--r-- 1 root other 118010 Nov 24 17:29 SCMICRO!SILVE-941453.jpg-rw-r--r-- 1 root other 37554 Nov 24 17:29 SCMICRO!SILVE-941453_d.jpg-rw-r--r-- 1 root other 4760 Nov 24 17:29 SCMICRO!SILVE-941453_t.jpg-rw-r--r-- 1 root other 37544 Nov 24 17:29 SCMICRO!SILVE-941463.jpg-rw-r--r-- 1 root other 21298 Nov 24 17:29 SCMICRO!SILVE-941463_d.jpg-rw-r--r-- 1 root other 3119 Nov 24 17:29 SCMICRO!SILVE-941463_t.jpg#!/bin/bashDIRECTORY_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 donedone~~~~~~~~~~Output:~~~~~~~~~~Dir = /www/htdocs/mpb/html/prod_img/1241/File = SCMICRO!SILVE-941443.jpgDir = /www/htdocs/mpb/html/prod_img/1241/File = SCMICRO!SILVE-941444.bmpDir = /www/htdocs/mpb/html/prod_img/1241/File = SCMICRO!SILVE-941445.jpg