# This script will copy or rename all files in a directory with # a prefix of 01 through 0(count). Useful for renaming MP3 # files to play in ASCII sort order. IF count exceeds 99 add a 0, # if count exceeds 999 add to 0's. #!/bin/ksh # # april 2004 - john meister # numbers & cp's files w/prefix 0# # if count exceeds 99 add a 0 to cp line # change cp to mv if original file not needed # # establish base count: count="1" # set loop variable "a" to value from ls command: for a in `ls` # while values exist in ls: do # copy each line from ls, i.e. filename, to 0#_filename cp $a "0"$count"_"$a # increment counter by one count="$((count+1))" # if any values exist in ls repeat loop, when finished exit loop done