经典的批量处理软件-超强!
小工具大用处,每当用些小工具解决上千个文件的批量操作,那种感觉真的是太好了,这要感谢那些工具开发的程序人员。
Replace Pioneer 批量重命名工具
这东西实在太强大了,其他不管,只要达到我的目的:
上面的几千个html文件,命名很乱,我现在要批量把他们都按html里面的第一行内容作为文件名,也就是上面几千个含“标题”的html文件,批量以第一行命名。
这软件网上有许多教程,可以达到以哪行几个字符开始,限制多少字符作为重命名等等,功能相当强大!点这里查看官方用法 ,还有民间收集用法,再来个百度百科里介绍的用法
这次遇到的问题是这样的:
文件内容:
第一个html文件 <title>fowheg很多代码wjhgopw<h4>标题</4>ljoijopj太多代码isjgoiwngnwoi</title>
第二个html文件 <title>pojodoi很多代码fhosdgis<h4>标题</4>ljoijopjp太多代码ojgoisgnwoih</title>
第N个html文件。。。上千个文件
目的:直接删除其他东西,保留“标题”内容。
这样的文件要想保留<h4>里面的标题删除其他乱七八糟的东西,原来还在想是否有批量正则采集工具,但是那样太麻烦了,有了这款软件,一切简单好多,直接可以用到标记替换,太好用了!
填好前面和后面,替换留空,然后直接按开始替换,几千个文件一下子就删除了没用的东西,这样就保留了中间要的部分,这是一般的批量替换删除不了的功能。
通过这两个文件,我处理完几千个html文件,并且每个文件以文本的第一行重命名,相当不错的软件。
好了两款软件推荐完了,最后再推荐一款,那就是 文件批量处理百宝箱,不好意思,好像上面两个功能它都能做到,只是下面这个我还是不懂:
现在问题来了,那几千个文件每个文件都在不同的文件夹里面,也就是文件夹也有几千个,除了html文件,目录下还有几千个html里配图的图像文件,这些图片命名也是乱七八糟,我现在需要把他们的名字和几千个html命名一样,但是后缀名当然是不同的,要怎么做到呢?希望知道的留言告知 :)
上面这个问题彻底解决了,另附强大的批量重命名代码:
编号
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
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}
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)+1,"02")>${EXT}
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}
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}
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}
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
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}
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}
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_d",$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}
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}
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'}
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}
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}
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}
上一篇:参加钢琴比赛
相关日志
- 暂无相关文章
难道系统的ren命令不行吗
@Louis Han ren可以根据文本内容进行批量重命名吗?
文件名批量重命名还是不错的,记得以前把大量名字很长的课件拷到手机上就看不到序号了,非常的麻烦。
如果是某个目录下面有n个目录,n个目录里面有各种各样的文件,这样批量处理还是有办法的——就是不知道你最后面那段说的是不是这个需求?
@zwwooooo 就是有n个目录,一个html文件,一个对应的图片。
看起來還是挺有用的~~
可以去除图片里面的HTML文件名称,把所有文件规整到一个图片文件夹里头,然后在批量替换里面的图片名称。不知道这样可行不
@杜浔 图片里html名称是什么?目前我是放在excel里批量导入相应名称的图片,接下来最好是对其进行按名字排列进行批量重命名为另一个列的值,就是按文本内容重命名。
@郑永 哈哈,Excel 配合 记事本,有可能之前还 dir 把文件列表变成文本。
@董建 其实Replace Pioneer这款就可以根据文件夹命名了,汗!相当强大,佩服作者!
大家早上好啊! 好 。
再见!
学习了,收藏啦。
非常不错的工具说,偶也试试去^_^
写个脚本处理应该没啥问题
@axiu 可是不会,去搜的话也很少人会提类似问题。
@axiu 哈哈,不用脚本了,就原来第二款软件就能搞定了! 它的功能强大无比,原来没发现有这个功能,太难发现,哈哈。新贴的代码就可以做到了。
遍历->读取目录下文件内容->按内容更改目录名?
很强的工具,貌似是两款,不是三款哈。
批量替换代码,习惯使用 Dreamweaver,也是极强。
批量改文件名,简单的我用看图工具XnView,稍麻烦的用DOS弄个BAT。不过把html中的文本作为文件名,那确实都不行,你这款工具厉害(这种需求好像比较少)。
@董建 呵呵,谢谢你的细心阅读,的确只介绍两款,不过这两天对Replace Pioneer的加深认识,发现是款无敌批处理软件,一款就能替代好几款,哈哈。强大!!
有这个时间,你可以去学学Python~~