个人项目的设计建议 - “文件重命名器”?
我刚刚开始学习 winapis 和 c++ 编程..
我正在考虑启动一个个人项目(以增强我的编码,并帮助我更好地理解 winapis)..
我决定编写一个“cmd”文件重命名器,基本上需要:
1)一条路径
2)一个关键字
3)所需的格式
4)是否有版本(或编号,就像如果你有20集同一节目,你不会想要 截断剧集编号)..
5)要删除的特殊情况(例如,当您下载 torrent 时,它们的名称附加有 [309u394] .. 大多数情况下会带有首字母 [WE-RIP-TV-SHOWS-HDTV -FANSUBS-GROUPS-ETC]
我正在构建逻辑如下:
程序采用路径(输入1),
执行完整文件索引..然后将找到的文件与关键字进行比较 示例给出(输入 2)(使用正则表达式?)
重新格式化文件名步骤。 (输入3、4、5);
保存文件名。
问题:
A)我的逻辑流程正确吗? 有什么建议可以改进吗?
B) 我应该使用正则表达式来检查文件名、关键字和所需的格式吗? (正则表达式还不好),我的意思是这是执行大量比较的最佳方法吗?
i've just started learning winapis and c++ programming ..
i was thinking about starting a personal project (to enhance my coding, and to help me understand the winapis better)..
and i've decided to program a "cmd" files renamer, that basically takes :
1)a path
2)a keyword
3)the desiered formate
4)versioned or not (or numbered, like if u had 20 episodes of the same show, u wouldnt wanna
truncate the episode number)..
5)special cases to delete (like when ur downloading a torrent, they have a [309u394] attached to the name.. and most of the time an initial [WE-RIP-TV-SHOWS-HDTV-FANSUBS-GROUPS-ETC]
i am building the logic as follows:
the program takes the path(input 1),
performs a full files indexing.. then it compares the files found against the keyword
example gives (input 2) (use regex?)
Reformat file name step. (input 3, 4, 5);
save file name.
questions:
A) is my logic flow proper? any suggestions to improve it?
B)should i use Regex to check against file name, keyword, and desired format? (not good with regex yet) , i mean is it the best way to perform the huge amount of comparisons ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正则表达式应该可以解决问题。 您也可以使用 Boost 库,它有一些非常简洁的函数,包括 regexp,这可能比您在周围找到的函数更快(:
Regular expressions should do the trick. Also you could use the Boost library, it has some really neat functions including the regexp, which is probably faster than the functions you'll find around (: