Renaming files appened sequential numbers

Many time we feel a requirement of renaming our multiple file with single name and having versioning or appended number after the real name.

There is hardly any light weight application available for the purpose.

 

after search i found the solution which i like to share with all of you peoples.

I am using shell script or say bash file for that solution

Steps

  1. Create  a file having extention .sh say bash.sh
  2. Add text to the file where appended_string is the text you want to append example (its_my_file)
  3. Change the extention “.jpeg” with your type of files.
    x=1
     for j in *.jpeg; do
     new=$(printf "appended_string%03d.jpeg" "$x") #03 pad to length of 3
     mv -- "$j" "$new"
     let x=x+1
     done
    use

    mv -i -- "$j" $new"

    if you do not want to automatically overwrite existing files.

  4. Place the File in directory or folder in which your file with given extention(.jpeg) is placed.
  5. Open Command Line tool Like Terminal
  6. Run file typing command
    sh bash.sh

    or

    ./bash.sh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s