How can I rename an ordered list of files with an ordered list of file names?
For example save this file as filenames.txt:

apple
banana
orange


Then run:

a=($(&lt;filenames.txt));for d in *;do i=0;for f in $d/*;do echo mv $f $d/${a[i++]}.jpg;done;done


Remove echo if the output looks right.

If the file names contain spaces, add IFS=$'\n'; to the start and add double quotes around the variables.