Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (foo1, foo2, ..., foo1300, ..., fooN)
- (foo00001, foo00002, ..., foo01300, ..., fooN)
- for f in foo[0-9]*; do mv $f `printf foo%05d ${f#foo}`; done
- for i in ((i=1; i<=N; i++)) ; do mv foo$i `printf foo%05d $i` ; done
- rename 's/d+/sprintf("%05d",$&)/e' foo*
- for file in foo*; do
- newnumber='00000'${file#foo} # get number, pack with zeros
- newnumber=${newnumber:(-5)} # the last five characters
- mv $file foo$newnumber # rename
- done
- #!/bin/bash
- # some test data
- files="foo1
- foo2
- foo100
- foo200
- foo9999"
- for f in $files; do
- prefix=`echo "$f" | cut -c 1-3` # chars 1-3 = "foo"
- number=`echo "$f" | cut -c 4-` # chars 4-end = the number
- printf "%s%04dn" "$prefix" "$number"
- done
- #!/bin/bash
- for file in foo[0-9]*.png; do
- # strip the prefix ("foo") off the file name
- postfile=${file#foo}
- # strip the postfix (".png") off the file name
- number=${postfile%.png}
- # subtract 1 from the resulting number
- i=$((number-1))
- # copy to a new name in a new folder
- cp ${file} ../newframes/$(printf foo%08d.png $i)
- done
Add Comment
Please, Sign In to add comment