Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming files with adding a number to filename in bash

Tags:

People also ask

How do I sequentially number files in a folder?

Right-click on one photo in the group and select Rename from the menu. Name the pictures by type (for example, Wallpaper). Then press Enter or click on the blank space. The files should be renamed and numbered in parentheses.


I have lots of file like these:

13831_1.jpg
13838_1.jpg
138035_1.jpg
138037_1.jpg
138039_1.jpg

I need to add a value of 5000000 to the numbers of the filenames. The result should be the following:

5013831_1.jpg
5013838_1.jpg
5138035_1.jpg
5138037_1.jpg
5138039_1.jpg

Is there a way to do it with bash or perl?