Often download some materials and learning videos, often these data names are many, want to batch modification and very inconvenient, just use Python to write a change the file name of the applet.
Install Python under Windows This is not much to say, directly download the installation program can be installed. Https://www.python.org/downloads/3.x 2.x is available
I this program, is the use of regular expressions in the way, for some of the more biased file names to filter changes. There is no modification for subdirectories, so you can use them on your own line.
rename-input.py
#!/usr/bin/env python#coding:utf-8#create by shenfly231#modify file nameimport Sys,os,redef newname (OLDSTR,NEWSTR): dirname = os.listdir () p=re.compile (OLDSTR) for item in dirname: os.rename (Item,p.sub (Newstr,item )) return 0;if __name__ == ' __main__ ': oldtext = input ("Enter a string with a regular expression, special characters with \ escape:") newtext = input (" Enter the string you want to replace with a null, direct enter: ") result = newname (Oldtext,newtext) if result == 0: print (' conversion success ') else: print (' conversion problem ') input ("\ n Enter Exit")
How to use: Copy the program files to the same directory as the file you want to modify, double-click the program to open it in Python open mode.
Before: \d represents a number, {1-2} represents a number, and the regular expression reference will understand how to write.
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/90/5A/wKioL1jwOUnBMiBxAABhoORejGU585.jpg "title=" 11. JPG "alt=" wkiol1jwounbmibxaabhoorejgu585.jpg "/>
After modification
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/90/5B/wKiom1jwOQmx6Mt3AAAxxZNOhKA555.jpg-wh_500x0-wm_ 3-wmp_4-s_1387821303.jpg "style=" Float:none; "title=" 22.jpg "alt=" Wkiom1jwoqmx6mt3aaaxxznohka555.jpg-wh_50 "/>
This article comes from the "Endless Struggle for Life" blog, please be sure to keep this source http://shenfly231.blog.51cto.com/12811004/1915879
Bulk modification of file names under Python windows