1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 好用工具分享--推荐一个好用的跨平台的批量重命名文件或者文件夹工具【f2】

好用工具分享--推荐一个好用的跨平台的批量重命名文件或者文件夹工具【f2】

时间:2019-02-21 20:02:50

相关推荐

好用工具分享--推荐一个好用的跨平台的批量重命名文件或者文件夹工具【f2】

文章目录

说明:f2工具使用:1、windows安装:2、用法查看:1、查看用法说明对应的中文翻译解释: 2、准备好一个目录文件3、常用搜索测试1)、搜索文件夹或者文件名包含`美女`的结果2)、将搜索结果替换预览:3)、正则替换: 总结:

说明:

今天发现一个好用的工具,可以批量重命名本地文件或者文件夹,可以批量替换。

只是。macos、linux、window多个平台。

GitHub项目地址:

各平台安装使用文档

f2工具使用:

剩下我就摸搜着学习使用下这个工具再windows上如何使用。

1、windows安装:

找到项目的tags目录,然后我现在一个最新的版本。

tag地址

比如,下载地址:/ayoisaiah/f2/releases/tag/v1.6.7

我这里选择win64位下载下来。

下载了然后解压之后,放到不动的盘符,把目录放到添加到环境变量。

2、用法查看:

1、查看用法说明

win+R进入cmd,然后输入:

f2 -hE:\>f2 -hDESCRIPTION:F2 is a command-line tool for batch renaming multiple files and directories quickly and safelyUSAGE:f2 FLAGS [OPTIONS] [PATHS...]AUTHOR:Ayooluwa Isaiah <ayo@freshman.tech>VERSION:v1.6.7FLAGS:-f, --find <pattern>Search pattern. Treated as a regular expression by default unless --string-mode is also used. If omitted, it defaults to the entire file name (including the extension).-r, --replace <string>Replacement string. If omitted, defaults to an empty string. Supports built-in and regex capture variables. Learn more about variable support here: /ayoisaiah/f2/wiki/Built-in-variables-u, --undoUndo the last operation performed in the current working directory if possible. Learn more: /ayoisaiah/f2/wiki/Undoing-a-renaming-operationOPTIONS:-l, --replace-limit <integer>Limit the number of replacements to be made on the file name (replaces all matches if set to 0). Can be set to a negative integer to start replacing from the end of the file name.-s, --string-modeOpt into string literal mode. The presence of this flag causes the search pattern to be treated as a non-regex string.-E, --exclude <pattern>Exclude files/directories that match the given search pattern. Treated as a regular expression. Multiple exclude patterns can be specified.-x, --execExecute the batch renaming operation. This will commit the changes to your filesystem.-R, --recursiveRecursively traverse all directories when searching for matches. Use the --max-depth flag to control the maximum allowed depth (no limit by default).-m, --max-depth <integer>Positive integer indicating the maximum depth for a recursive search (set to 0 for no limit).--sort <sort>Sort the matches according to the provided '<sort>'.Allowed sort values:'default': alphabetical order'size': file size'mtime': file last modified time'btime': file creation time (Windows and macOS only)'atime': file last access time'ctime': file metadata last change time--sortr <sort>Same as --sort but presents the matches in the reverse order.-i, --ignore-caseWhen this flag is provided, the given pattern will be searched case insensitively.-q, --quietActivate silent mode which doesn't print out any information including errors-e, --ignore-extIgnore the file extension when searching for matches.-d, --include-dirInclude directories when searching for matches as they are exempted by default.-D, --only-dirRename only directories, not files (implies --include-dir)-H, --hiddenInclude hidden directories and files in the matches (they are skipped by default). A hidden file or directory is one whose name starts with a period (all operating systems) or one whose hidden attribute is set to true (Windows only)-F, --fix-conflictsAutomatically fix conflicts based on predefined rules. Learn more: /ayoisaiah/f2/wiki/Validation-and-conflict-detection--allow-overwritesAllow the overwriting of existing files-h, --helpshow help-v, --versionprint the versionDOCUMENTATION:/ayoisaiah/f2/wikiWEBSITE:/ayoisaiah/f2

对应的中文翻译解释:

旗帜:-f, --find <模式>搜索模式。默认情况下将其视为正则表达式,除非还使用了 --string-mode。如果省略,则默认为整个文件名(包括扩展名)。-r, --replace <字符串>替换字符串。如果省略,则默认为空字符串。支持内置和正则表达式捕获变量。在此处了解有关变量支持的更多信息:/ayoisaiah/f2/wiki/Built-in-variables-u,--撤消如果可能,撤消在当前工作目录中执行的最后一个操作。了解更多:/ayoisaiah/f2/wiki/Undoing-a-renaming-operation选项:-l, --replace-limit <整数>限制对文件名进行的替换次数(如果设置为 0,则替换所有匹配项)。可以设置为负整数以从文件名末尾开始替换。-s, --string-mode选择字符串文字模式。此标志的存在导致搜索模式被视为非正则表达式字符串。-E, --exclude <模式>排除与给定搜索模式匹配的文件/目录。视为正则表达式。可以指定多个排除模式。-x, --exec执行批量重命名操作。这会将更改提交到您的文件系统。-R, --递归搜索匹配项时递归遍历所有目录。使用 --max-depth 标志来控制允许的最大深度(默认情况下没有限制)。-m, --max-depth <整数>正整数表示递归搜索的最大深度(设置为 0 表示没有限制)。--sort <排序>根据提供的“<sort>”对匹配项进行排序。允许的排序值:“默认”:字母顺序“大小”:文件大小'mtime': 文件最后修改时间'btime':文件创建时间(仅限 Windows 和 macOS)'atime': 文件上次访问时间'ctime': 文件元数据上次更改时间--sortr <排序>与 --sort 相同,但以相反的顺序显示匹配项。-i, --ignore-case提供此标志时,将不区分大小写地搜索给定模式。-q, --安静激活不打印任何信息(包括错误)的静默模式-e, --ignore-ext搜索匹配项时忽略文件扩展名。-d, --include-dir搜索匹配项时包括目录,因为默认情况下它们是免除的。-D, --only-dir仅重命名目录,而不重命名文件(暗示 --include-dir)-H, --隐藏在匹配中包含隐藏的目录和文件(默认情况下会跳过它们)。隐藏文件或目录是名称以句点开头的文件或目录(所有操作系统)或隐藏属性设置为 true 的文件或目录(仅限 Windows)-F, --fix-conflicts根据预定义的规则自动修复冲突。了解更多:/ayoisaiah/f2/wiki/Validation-and-conflict-detection--allow-overwrites允许覆盖现有文件-h, --help显示帮助-v, --version打印版本

2、准备好一个目录文件

查看准备的文件树:

注意点::

window下是:tree /f,linux下是:tree -f

E:\photos\f2-demo>tree /f卷 data 的文件夹 PATH 列表卷序列号为 2EC0-3153E:.├─76296_顶级迷人美女销魂巨乳酒店人体艺术写真壁纸│0.jpg│├─76474_清纯双马尾辫美女铁轨写真手机壁纸│0.jpg│1.jpg│2.jpg│3.jpg│4.jpg│5.jpg│6.jpg│7.jpg│8.jpg│├─77478_治愈系美女性感露肩私房写真手机壁纸│0.jpg│1.jpg│2.jpg│├─78727_居家俏皮美女私房性感写真图片手机壁纸│0.jpg│1.jpg│├─79401_圣诞节元气美女可爱写真图片手机壁纸│0.jpg│1.jpg│2.jpg│3.jpg│4.jpg│5.jpg│├─80835_长发美女清纯温婉写真图片手机壁纸│0.jpg│1.jpg│2.jpg│3.jpg│4.jpg│5.jpg│├─82663_清纯氧气美女居家养眼写真图片手机壁纸│0.jpg│1.jpg│2.jpg│3.jpg│4.jpg│└─85483_清纯可爱美女私房性感俏皮写真手机壁纸0.jpg1.jpg

3、常用搜索测试

1)、搜索文件夹或者文件名包含美女的结果

f2 -f 美女 -d -R

搜索结果包括文件夹,需要加入-d参考,默认是不包含文件夹。

我这里搜到修改了几个子目录命名加入“美女”,这样就搜索到了。

2)、将搜索结果替换预览:

f2 -f 美女 -d -R -r "meinv"

这个时候,本地文件是不会改变的。加入-x才会执行替换。

# 执行之后,不会显示预览界面,直接修改本地文件名和文件夹了f2 -f 美女 -d -R -r "meinv" -x

3)、正则替换:

由于默认是支持正则替换的,然后测试是挺方便的

f2 -f "_.*?meinv" -d -R -r "meimei" -x

对比发现,下划线和meinv直接的目录,都被替换成meimei了。

总结:

更多用法,看你自己需求吧,我觉得对于一个目录下的有规律的文件重命名什么的,是完全好用。

但是对于一个目录下,子目录过多,或者文件很多【比如上百万,性能就不知道了】

不过再对于批量改名什么的,或者改一部分,简直就是方便的飞起。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。