标题: 正则更名工具rn.exe [打印本页]
作者: happy886rr 时间: 2016-11-3 23:38 标题: 正则更名工具rn.exe
本帖最后由 happy886rr 于 2016-11-4 09:56 编辑
RN.EXE [version 1.1]修复一个bug
__________________________________________________________________________________
正则表达式更名工具,支持指定目录,递归目录,测试更名。C语言编写,体积仅8KB,
比ren2更名快2倍的强劲性能。
__________________________________________________________________________________
位开关数传,一切都是如此迅捷。
void RE_Rename(
const char* Org_Path, //工作目录
char* RE_Match, //要匹配的正则
char* RE_Format, //要更名的正则
unsigned char FLAG //位开关
)
__________________________________________________________________________________
使用:
rn -p [要更名的文件路径] [-f|-t|-fr|-tr] ["正则匹配表达式"] ["正则更名表达式"]
__________________________________________________________________________________
选项:
-h 帮助信息
-p 设置工作目录
-f 执行更名,使用-fr将会递归子目录
-t 测试更名,使用-tr将会递归子目录
__________________________________________________________________________________
示例:
rn -f "(.*)-(.*)(\.txt)" "\2\3" //在当前目录,截取“-”后更名
rn -t "(.*)-(.*)(\.txt)" "\2\3" //在当前目录,截取“-”后测试更名
rn -fr "(.*)-(.*)(\.txt)" "\2\3" //在当前目录递归子目录,截取“-”后更名
rn -p "D:\test" -fr "(.*)-(.*)(\.txt)" "\2\3"
//指定目录“D:\test”递归子目录... 更名
__________________________________________________________________________________
英译:
COPYRIGHT@2016~2018 BY HAPPY, VERSION 1.0
REGULAR RENAMING TOOLS
----------------------------------------------------------------------------------
rn -p [path] [-f|-t|-fr|-tr] ["match expression"] ["format expression"]
----------------------------------------------------------------------------------
-h Show help information
-p Working home directory
-f Exec regular renaming, use -fr to recursive subdirectories
-t Test regular renaming, use -tr to recursive subdirectories
----------------------------------------------------------------------------------
03TK::11/03/2016
核心代码- /*
- REGULAR RENAMING TOOLS, VERSION 1.0
- RN.EXE
- COPYRIGHT@2016~2018 BY HAPPY
- */
- #include "rn.h"
- #include <stdbool.h>
- #include <direct.h>
- #include <io.h>
-
- //定义路径名最大长度(字节)
- #define PATH_SIZE 1024
- //定义文件名最大长度(字节)
- #define FNAME_SIZE 1024
-
- //正则命名函数
- void RE_Rename(
- const char* Org_Path, //工作目录
- char* RE_Match, //要匹配的正则
- char* RE_Format, //要更名的正则
- unsigned char FLAG //位开关
- )
- {
- int start, length;
- char Org_Name[FNAME_SIZE];
- char Cur_Path[ PATH_SIZE];
- char path[ PATH_SIZE];
-
- //获取当前目录
- _getcwd(Cur_Path, PATH_SIZE);
-
- //设置工作目录
- _chdir(Org_Path);
-
- struct _finddata_t FileS;
- intptr_t handle=_findfirst("*",&FileS);
- bool M=(handle==-1)?true:false;
-
- while(!M){
-
- //装饰路径
- if(
- (Org_Path[1]!= ':') &&
- (Org_Path[0]!='\\')
- ){
- strcpy(path, Cur_Path);
- strcat(path, "\\");
- }
- if(strlen(Org_Path)>0){
- strcat(path, Org_Path);
- strcat(path, "\\");
- }
-
- //备份名称
- strcpy(Org_Name, FileS.name);
-
- //正则查找
- if(RegexFind(Org_Name, RE_Match, &start, &length)==1){
- //正则更名
- RegexReplace(FileS.name, RE_Match, RE_Format, &start, &length);
- //交互显示
- if(FLAG&1){
- const char* PathName=strcpy(path, Org_Name);
- if(rename(PathName, FileS.name)==0){
- printf("[Done] %s --> %s\n", Org_Name, FileS.name);
- }else{
- printf("[Error] %s --> %s\n", PathName, FileS.name);
- }
- }else{
- printf("[Show] %s --> %s\n", Org_Name, FileS.name);
- }
- }
- M=(_findnext(handle, &FileS)!=0)?true:false;
- }
- _findclose(handle);
-
- //递归子目
- if(FLAG>>4){
- handle=_findfirst("*.*", &FileS);
- M=(handle==-1)?true:false;
- while(!M){
- if(FileS.attrib & _A_SUBDIR){
- if(
- (strcmp(FileS.name, ".")!=0) &&
- (strcmp(FileS.name,"..")!=0)
- ){
- //函数递归
- RE_Rename(FileS.name, RE_Match, RE_Format, FLAG);
- }
- }
- M=(_findnext(handle, &FileS)!=0);
- }
- _findclose(handle);
- }
-
- //还原目录、释放内存
- _chdir(Cur_Path);
- free(Org_Name);
- free(Cur_Path);
- }
-
- //帮助信息
- void Help_Information(FILE* stream, int Exit_Code)
- {
- fputs(
- "COPYRIGHT@2016~2018 BY HAPPY, VERSION 1.0\n"
- "REGULAR RENAMING TOOLS\n"
- "-----------------------------------------------------------------------------\n"
- "rn -p [path] [-f|-t|-fr|-tr] [\"match expression\"] [\"format expression\"]\n"
- "-----------------------------------------------------------------------------\n"
- " -h Show help information\n"
- " -p Working home directory\n"
- " -f Exec regular renaming, use -fr to recursive subdirectories\n"
- " -t Test regular renaming, use -tr to recursive subdirectories\n"
- "-----------------------------------------------------------------------------\n"
- " 03TK\n"
- ,stream
- );
- exit(Exit_Code);
- }
-
- /*****MAIN主函数入口*****/
- int main(int argc, char ** argv)
- {
- int i=1;
- char* Work_Path;
- unsigned char FLAG;
-
- if(argc<4){Help_Information(stderr, 1);}
-
- if( (argv[i][0]=='-') && (argv[i][1]=='p') ){
- if( !access(argv[2], 0) ){
- Work_Path=argv[2];
- i+=2;
- }else{
- fputs("Error path\n", stderr);
- return 2;
- }
- }else{
- Work_Path="";
- }
-
- if(argv[i][0]=='-'){
- if(argv[i][2]== 'r'){
- FLAG=0x10;
- }else{
- FLAG=0x00;
- }
- switch (argv[i][1]){
- case 'f' : //执行改名
- FLAG|=0x01;
- break;
- case 't' : //示范改名
- FLAG&=0xF0;
- break;
- default :
- fputs("Error option\n", stderr);
- return 1;
- }
- //调用正则命名函数
- RE_Rename(Work_Path, argv[i+1], argv[i+2], FLAG);
- }else{
- Help_Information(stderr, 1);
- }
-
- return 0;
- }
复制代码
文件下载,base64码- @echo off
- ::*********BASE64 过滤解码器*********
- certutil -decode "%~f0" rn.zip&pause&exit /b
- ::***********************************
-
- -----BEGIN BASE64-----
- UEsDBBQAAAAIAOxNZEm4UpP2BgMAAEMIAAAJAAAAcmVhZG0udHh0tVXdT9pQFH9ek/4PNzypoVQwWQxPQ4doVCDIPowYglg+MmlJe3EuMftfal22KA+wgQMRWASnc4siMDTL3Fe2bMs+TLbEJVOW9VIqLJtuLnAeTttzf/fc3zn3nFOLU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YdV7w6V2nCYLVHEtxfY4Cc+htdrAj/x7jy8+kAk5emfLEXsGFoH89p47dtrwNdKW6OHDcYPFApH/d8ZChcEzhL8AUEsBAh8AFAAAAAgA7E1kSbhSk/YGAwAAQwgAAAkAJAAAAAAAAAAgAAAAAAAAAHJlYWRtLnR4dAoAIAAAAAAAAQAYAI3hrGQ9NtIB47Kb8D020gHjspvwPTbSAVBLAQIfABQAAAAIAENOZEnpwLF1PhwAAAAgAAAGACQAAAAAAAAAIAAAAC0DAABybi5leGUKACAAAAAAAAEAGACAcc/EPTbSAYNRmfA9NtIBg1GZ8D020gFQSwECHwAKAAAAAABITmRJAAAAAAAAAAAAAAAABAAkAAAAAAAAABAAAACPHwAAc3JjLwoAIAAAAAAAAQAYAKxtlco9NtIBrG2Vyj020gGaqsIzOzbSAVBLAQIfABQAAAAIAM9NZEm96qOYHgYAAKwOAAAIACQAAAAAAAAAIAAAALEfAABzcmMvcm4uYwoAIAAAAAAAAQAYABOO1kM9NtIBg1GZ8D020gGDUZnwPTbSAVBLAQIfABQAAAAIAJBLZElHmdprrAAAAM8BAAAIACQAAAAAAAAAIAAAAPUlAABzcmMvcm4uaAoAIAAAAAAAAQAYAOW2S8E6NtIB47Kb8D020gHjspvwPTbSAVBLBQYAAAAABQAFAL0BAADHJgAAAAA=
- -----END BASE64-----
复制代码
作者: 523066680 时间: 2016-11-4 11:40
本帖最后由 523066680 于 2016-11-4 11:46 编辑
perl挺合适做这个
http://bbs.bathome.net/thread-34881-1-2.html
C语言, 在遇到带unicode符号的文件名时,应该是用 Win32 API 那一套比较合适
作者: happy886rr 时间: 2016-11-4 11:53
回复 2# 523066680
是啊,但是考虑到perl体积巨大。转化为双字是好处理。
作者: pcl_test 时间: 2016-11-4 12:47
建议在帮助信息里说明下支持咋样的正则表达式和元字符,比如数字是否支持[0-9]和\d两种,是否支持{m,n}等,另外加上文件和文件夹独立开关,默认同时处理文件和文件夹,对于有时仅需要处理子目录下的文件或文件夹时,如果存在同名的文件和文件夹,就会误伤
作者: happy886rr 时间: 2016-11-4 12:57
回复 4# pcl_test
感谢大师建议,下一版本会采纳,并改用其他正则引擎,以加强正则表达式的支持程度。
作者: CrLf 时间: 2016-11-25 01:09
强烈建议改成宽字符版本
作者: CrLf 时间: 2016-11-25 01:32
另外,从源码看起来好像是有重复更名的问题,就是会把已经改过名的文件再次改名...
作者: happy886rr 时间: 2016-11-25 09:21
回复 7# CrLf
感谢大师提醒,我打算换用pcre的核心,这个迷你版rn用的正则库太简单了,只支持非常低级的正则,不支持什么\d ?等高级正则。如果更换引擎,生成的exe文件将会超过20kb。
作者: CrLf 时间: 2016-11-25 10:25
回复 8# happy886rr
有个 PCRE2,语法类似,但版本号大变,不知道是多了什么内容
作者: happy886rr 时间: 2016-11-25 22:58
回复 9# CrLf
pcer2体积太大了,800kb多,不过pcre2的功能很强大。同时正则越复杂,运行速度越慢。
作者: CrLf 时间: 2016-11-25 23:29
回复 10# happy886rr
pcre 和 pcre2 默认编译的内容中有 JIT 之类非必要的模块,如果只编译最基本的源码,会小很多,大概是 100K+
作者: happy886rr 时间: 2016-11-25 23:56
JIT 我去查查,我对这些不是很熟。但是正则非常好玩。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |