可能大家都有过以下类似经验:
1,一堆名字类似的文件都要加个后缀名(or 复制后改名)
2,某目录下所有文本里某个关键字需要替代
自己已经碰到不少次了,因为量不是很大所以每次都是干手工活。最近工作比较闲,用python写了几个工具玩玩,有同样需求的趣的朋友可以下载参考下,改成自己用着方便的。⬇
https://github.com/spicyoil/batch-rename-modify-context-copy-files-dirs-by-rules
●使用方法
#change_contents_script.py #used only for files
#usage: .py target_keyword replace newword oldword
#usage: .py target_keyword delete newword
#change_name_script.py #used for files and dirs
#usage: .py target_keyword replace newword oldword
#usage: .py target_keyword delete oldword
#usage: .py target_keyword add newword
#copy_file_script.py #used only for dirs
#usage: .py target_keyword replace newword oldword
#usage: .py target_keyword delete oldword
#usage: .py target_keyword add newword
Be careful I only test them in Python2
All scripts only works on current directory
target_keyword :is used to search the files/dirs which match
add: can only to add string in the end