Something like this (in bash) shopt -s extglob n=1000 for file in *.jpg;do mv $file ${file/_+([0-9])/_$n}; n=$((n+1)); done Alan Dayley wrote: >I have a bunch of photo files with the same root name and a number. The files >are in the directory ordered from least to greatest but are not sequential. >Like this: > >birthdayParty04_345.JPG >birthdayParty04_348.JPG >birthdayParty04_357.JPG >birthdayParty04_392.JPG >birthdayParty04_403.JPG > >I want to rename them so they are in the same order but the numbers are >sequential. Like this: > >birthdayParty04_001.JPG >birthdayParty04_002.JPG >birthdayParty04_003.JPG >birthdayParty04_004.JPG >birthdayParty04_005.JPG > >My scripting skills are less than good and so far my attempts to do this have >ended in failures of various degrees. Does anyone have a quick answer they >can provide? > >Alan >--------------------------------------------------- >PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us >To subscribe, unsubscribe, or to change you mail settings: >http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss > > > --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss