All pastes #816562 Raw Edit

Anonymous

public shellscript v1 · immutable
·published 2007-12-14 21:13 UTC
rendered paste body
"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/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