Go into each dir and rename everything in it to dir name(number).jpg
Jump to navigation
Jump to search
#!/bin/bash #i is directory name #j is original file name cd ~/projects/wndchrm for i in *; do if [ -d $i ]; then y=1 echo "Entering $i" cd $i for j in *; do echo "$j becomes ${i}_$y.jpg" mv $j ${i}_$y.jpg y=`expr $y + 1` done else echo "$i is not a directory." fi cd ~/projects/wndchrm done