Joined: Oct. 2005
||Posted: Oct. 27 2005,15:53
I need help writing a piece of bash.
What I am trying to do is get a bash script to target single digit file names and convert them to double digits. Lets say this is what I have in my folder:
I would like the bash script to rename 1.jpg, 2.jpg, 3.jpg, 4.jpg, and 5.jpg into 01.jpg, 02.jpg, 03.jpg, 04.jpg and 05.jpg. At the same time not mistakening the 11.jpg and 12.jpg as as 1.jpg and 2.jpg
The bash script will only target *.jpg formats so conflicts with 1.txt and 2.txt does not occour.
Okay, this is my newbism:
|Code Sample |
seq=(`seq 1 9`)
for loop in $file
mv $loop 0$loop
Like I said, my newbism.
How do I make this script functional? Please help.
Thanks in advance.