| [change file extension] | old name example | new name example | formula |
1 | change extension | file.txt | file.new | ${BASE}.new |
2 | insert before extension | file.txt | file.new.txt | ${BASE}.new.${EXT} |
3 | add new extension | file | file.new | ${FILENAME}.new |
| [re-organize any part of filename] | old name example | new name example | formula |
4 | take first 3 chars | abc1234.txt | abc.txt | ${BASE}{1,3}.${EXT} |
5 | take last 3 chars | 1234abc.txt | abc.txt | ${BASE}{-3,-1}.${EXT} |
6 | take 3 ~ 6 chars | ab1234c.txt | 1234.txt | ${BASE}{3,6}.${EXT} |
7 | take 1 ~ -3(3rd from end) chars | abcde12.txt | abcde.txt | ${BASE}{1,-3}.${EXT} |
8 | take 3 ~ -3(3rd from end) chars | ab1234cd.txt | 1234.txt | ${BASE}{3,-3}.${EXT} |
9 | first 3 and from the 8th char on | abc1234def.txt | abcdef.txt | ${BASE}{1,3}${BASE}{8,-1}.${EXT} |
10 | exchange 1,2 and 3,4 chars | abcd.txt | cdab.txt | ${BASE}{3,4}_${BASE}{1,2}.${EXT} |
| [add sequence number] | old name example | new name example | formula |
11 | sequence number of 1,2,3 ... | any.txt | N.txt(N=1,2, ...) | #.${EXT} |
12 | sequence number of 0001,0002,0003 ... | any.txt | N.txt(N=0001,0002,...) | ####.${EXT} |
13 | sequence number of 3,4,5,... | any.txt | N.txt(N=3,4, ...) | #{3}.${EXT} |
14 | sequence number of 5,7,9,...(start=5,step=2) | any.txt | N.txt(N=5,7,9,...) | #{5,2}.${EXT} |
15 | sequence number of 100,99,98,...(start=100,step=-1) | any.txt | N.txt(N=100,99,98,...) | ###{100,-1}.${EXT} |
16 | add sequence number 001,002,... before filename | file.txt | N_file.txt(N=001,002,...) | ###_${FILENAME} |
17 | append sequence number 001,002,... after filename | file.txt | file_N.txt(N=001,002,...) | ${BASE}_###.${EXT} |
18 | change the extension name to sequence 001,002,... | file.txt | file.N(N=001,002,...) | ${BASE}.### |
19 | append sequence aaa,aab,...zzz to filename | file.txt | file.txt.X(X=aaa,aab,aac,...zzz) | ${FILENAME}.@@@ |
20 | create sequence number of 01_01, 01_02, ... 01_10, 02_01, 02_02,... 02_10, 03_01,03_02,... | any.txt | M_N.txt(M:01,02,03,...,N:01~10) | #<calc(($&-1)/10+1,"02")>_#<calc(($&-1)%10+1,"02")>${EXT} |
| [string replace with regular expression] | old name example | new name example | formula |
21 | replace 'old' with 'new' in name | old123.txt | new123.txt | ${FILENAME}{replace,'old','new'} |
22 | remove any digit in filename | abc123def456.txt | abcdef.txt | ${BASE}{replace,'\d+',''}.${EXT} |
23 | remove digits that as surfix | abc123def456.txt | abc123def.txt | ${BASE}{replace,'\d+$',''}.${EXT} |
24 | remove digits that as prefix | 123abc456.txt | abc456.txt | ${BASE}{replace,'^\d+',''}.${EXT} |
25 | add parenthesis for any number | abc123def456.txt | abc(123)def(456).txt | ${BASE}{replace,'(\d+)','(\1)'}.${EXT} |
26 | remove all parenthesis in filename | abc(123).txt | abc123.txt | ${BASE}{replace,'\((.*?)\)','\1'}.${EXT} |
27 | change all parenthesis to bracket | abc(123).txt | abc[123].txt | ${BASE}{replace,'\((.*?)\)','[\1]'}.${EXT} |
28 | exchange parts before and after dash | abc-def.txt | def-abc.txt | ${BASE}{replace,'(.*?)-(.*)','\2-\1'}.${EXT} |
29 | change dash to parenthesis | abc-def.txt | abc(def).txt | ${BASE}{replace,'(.*?)-(.*)','\1(\2)'}.${EXT} |
30 | change all spaces to underscore | abc def.txt | abc_def.txt | ${BASE}{replace,'\s+','_'}.${EXT} |
| [rename from file content] | old name example | new name example | formula |
31 | change filename to the first word of file content | any.txt | firstword | ${FILENAME}{file_content,'(\S+)'} |
32 | change filename to the first 60 chars of 1st line of file content | any.txt | firstline(60 letter maximum) | ${FIRSTLINE}{1,60} |
33 | change filename to the first 60 chars of 2nd line of file content | any.txt | secondline(60 letter maximum) | ${FILENAME}{file_line,2}{1,60} |
34 | change filename to the title of html file | any.html | htmltitle.html | ${FILENAME}{html_title}{1,20}.html |
35 | change filename to the content between <strong> and </strong> | any.html | strongcontent.html | ###_${FILENAME}{file_content,'<strong>(.*?)<\/strong>',undef,10000}.${EXT} |
36 | change filename to the content followed by phase_name inside file | any.html | phase_name_content.html | ${FILENAME}{file_content,'phase_name\s*"(.*?)"'}.${EXT} |
| [rename from file date,time] | old name example | new name example | formula |
37 | change filename to the date time of file | any.jpg | 2010-07-01_18:19:20.jpg | ${FILENAME}{file_time, '%Y-%m-%d_%H:%M:%S'}.${EXT} |
38 | change filename to the date of file plus sequence number | any.jpg | 2010-07-01(N).jpg(N=01,02,03,...) | ${FILENAME}{file_time, '%Y-%m-%d'}(##).${EXT} |
39 | append file date to original filename | abc.jpg | abc_2010-07-01.jpg | ${BASE}_${FILENAME}{file_time, '%Y-%m-%d'}.${EXT} |
| [rename from MP3 file info] | old name example | new name example | formula |
40 | rename mp3 files to artist-album-track format | abc.mp3 | artist-album-track.mp3 | ${FILENAME}{mp3_info,'%R-%A-%T'}.mp3 |
41 | rename mp3 files to artist-album format with sequence number | abc.mp3 | artist-album_N.mp3(N=001,002,...) | ${FILENAME}{mp3_info,'%R-%A'}_###.mp3 |
42 | append artist and album after original filename | abc.mp3 | abc_arrist-album.mp3 | ${BASE}_${FILENAME}{mp3_info,'%R-%A'}.mp3 |
| [rename from image file info] | old name example | new name example | formula |
43 | rename jpg files by adding sequence and picture width, height | abc.jpg | N_W_H.jpg(N=001,002,... W=width, H=height) | ###_${FILENAME}<img_info($&,'%W_%H')>.${EXT} |
44 | rename gif files by appending width and height | abc.gif | abc_WxH.gif(W=width,H=height) | ${BASE}_${FILENAME}<img_info($&,'%Wx%H')>.${EXT} |
| [rename from index file/mapping file] | old name example | new name example | formula |
45 | change the Nth filename to the Nth line of indexfile | file.jpg(sequence number=N) | X_(lineN_of_indexfile).jpg(N=file sequence,X=001,002,...) | ###_#<file_line('indexfile',$match)>.${EXT} |
46 | change the filename by looking up the mapping list in mapfile(1) | old.txt | new.txt(old<table>new is defined in mapfile) | ${BASE}<file_content('mapfile',"(?:\n|^)$match\t([^\n]*)")>.${EXT} |
47 | change the filename by looking up the mapping list in mapfile(2) | old.txt | new.txt(old,new is defined in mapfile) | ${BASE}<file_content('mapfile',"(?:\n|^)$match,([^\n]*)")>.${EXT} |
| [rename with directory name] | old name example | new name example | formula |
48 | add the pathname in the front of filename | c:\test\abc\01.jpg | abc_01.jpg | #<basename(getcwd)>_${FILENAME} |
49 | add the pathname and related sequence no in the front of filename | c:\a\x.jpg, y.jpg c:\b\x.jpg, y.jpg | a_001.jpg, a_002.jpg, b_001.jpg, b_002.jpg | #<sprintf("%s_%03d",$A=basename(getcwd),($A eq $B && $match!=1)?++$I:($I=1),$B=$A)>.${EXT} |
50 | create subfolder and move file in it | c:\test\a.txt | c:\test\old\a.txt | #<scalar(system('mkdir old'),'old')>\${FILENAME} |
| [rename with Uppler/Lower cases] | old name example | new name example | formula |
51 | change whole filename to lower case | FILE.TXT | file.txt | ${FILENAME}{lc} |
52 | change whole filename to upper case | file.txt | FILE.TXT | ${FILENAME}{uc} |
53 | change the first letter to upper case | file.txt | File.txt | ${FILENAME}{ucfirst} |
54 | change the first letter of each word to upper case | test file.txt | Test File.txt | ${BASE}{replace,'\b\w','\U$&'}.${EXT} |
| [number calculation and re-formatting] | old name example | new name example | formula |
55 | change all number in filename to 4 digits format | file123.txt | file0123.txt | ${BASE}<replace($match,'(\d+)','${\calc($1,"04d")}')>.${EXT} |
56 | add all number in filename by 3, use 4 digits format | file123.txt | file0126.txt | ${BASE}<replace($match,'(\d+)','${\calc($1+3,"04d")}')>.${EXT} |
57 | multiply all number in filename by 2, use 4 digits format | file123.txt | file0246.txt | ${BASE}<replace($match,'(\d+)','${\calc($1*2,"04d")}')>.${EXT} |
58 | filename is pure number, add the number by the first number in file content | 123.txt | 133.txt(assume first number in file content is 10) | ${FILENAME}<add(basename($&),file_content($&,'(\d+)'))>.${EXT} |
59 | add leading zeros to make the filename has length of 10 | 12W.txt | 00012W.txt(total length is 10) | ${FILENAME}{calc,'010s'} |
| [generate random letters/words] | old name example | new name example | formula |
60 | append to filename random letters and digit with length of 5 | abc.txt | abc_xxxxx.txt(xxxxx is random letters/digits) | ${BASE}_#<rand_str(5,'a'..'z',0..9)>.${EXT} |
61 | rename file to random word from candidate words | abc.txt | N_C.txt(N=001,002,..., C=random of 'RED', 'PURPLE',...) | ###_#<rand_str(1,'RED','PURPLE','GREEN','BLUE','ORANGE')>.${EXT} |
| [letter re-mapping] | old name example | new name example | formula |
62 | change filename by mapping 0-9 to A-J correspondingly | 0123.jpg | ABCD.jpg | ${BASE}<scalar($&=~tr/0-9/A-J/,$&)>.${EXT} |
63 | change filename by mapping 0-4 to 5-9, and 5-9 to 0-4 | 012348888.jpg | 567893333.jpg | ${BASE}<scalar($&=~tr/0-4,5-9/5-9,0-4/,$&)>.${EXT} |
64 | change filename by reverse upper and lower cases | TELLme.txt | tellME.txt | ${BASE}<scalar($&=~tr/A-Za-z/a-zA-Z/,$&)>.${EXT} |
| [rename just for fun] | old name example | new name example | formula |
65 | reverse letters of filename | just for fun.txt | nuf rof tsuj.txt | ${BASE}{chars_r,1,-1}.${EXT} |
66 | double each letter in filename | just for fun.txt | jjuusstt ffoorr ffuunn.txt | ${BASE}{replace,'(.)','\1\1'}.${EXT} |