Under Windows, you can use the MATLAB program to batch name all the files sequentially, take pictures as an example, the code is as follows:
Path = ' C:\Users\Administrator\Desktop\select_img\ ';% all pictures stored paths d = Dir ([path ' *.jpg ']);% reads all files under this path into a struct for i = 1: Length (d)% traverse each picture image_name = D (i). name;% the name of each picture i = Imread (strcat (path,image_name));% reads each picture nz= strcat ('%0 ', NUM2STR (6), ' d ');% gives the picture the number of digits of the name temp_id = sprintf (Nz,i), and the% is named for all pictures, preceded by 0 name2 = strcat (temp_id, '. jpg '); Imwrite (i,name2);% save a picture with a new name end
Under Ubuntu You can use the terminal in the folder to enter the script program, all files in order to batch name, the script is as follows:
# first enter the following two lines of instruction, named for all files by ordinal, and to avoid conflicts with previous names (such as a number in the previous name), all the names followed by the letter a -I. num=0; for in ' ls ';d o mv-f $name ' echo $num'a.jpg'; num=num+1# again enter the following two lines of instruction, according to the serial number to re-name all files- i num=0; for in ' ls ';d o mv-f $name ' echo $num'. jpg'; num=num+1; Done
File batch naming in order (Windows+ubuntu)