Massren是一种命令行工具,可用于使用您自己的文本编辑器重命名多个文件。由于需要逃脱任何正则表达式,而且每个工具都使用其自己的语法和正则味道。 Massren的优点是您每天都使用您使用的文本编辑器,因此可以使用其所有功能。
该工具通过创建一个包含目标目录的文件名并在文本编辑器中打开该文件的文件来起作用。然后,您可以直接修改文件名。完成后,保存文本文件,文件将被重命名。未更改的线将简单地被忽略。
使用您自己的文本编辑器重命名多个文件。它应该与任何文本编辑器一起使用,包括VIM,Emacs,Sublime Text或Notepad。
撤消 - 任何重命名操作都可以撤销。
将文件移至子目录。有关更多信息,请参见这些说明。
干运行模式 - 测试重命名操作的结果,而无需实际重命名任何文件。
跨平台 - Windows,OSX和Linux得到支持。
安全检查 - 由于这是一个多重重命名工具,因此进行了各种检查,以确保任何事物都不意外地重命名。例如,该程序将在编辑文件名列表时检查文件是否没有被其他内容更改。如果保存之前和之后文件的数量不同,则该操作也将被取消。
每个平台的最新可执行文件可从发布页面获得。
最简单的方法是与自制:
brew install massren
或者,下面描述的Linux方法应起作用。
如果安装失败,请按照下面的说明进行操作。
go install github.com/laurent22/massren@latest默认情况下,该工具将安装在$GOPATH/bin/massren中。从那里,您可以将其链接到/bin ,也可以将$GOPATH/bin添加到PATH变量中,带有export PATH=$PATH:$GOPATH/bin 。
请注意,它与LinuxBrew兼容,因此与Mac OS相同的命令也可以正常工作。
可执行文件可以从https://github.com/laurent22/massren/releases下载
注意:从1.3版开始,Windows版本就会停止使用,因为我不知道它们是否被任何人使用。该程序仍然可以与Windows一起使用,并且可以使用上面的“ Linux”方法构建和安装。如果您有兴趣维护窗户版本,请告诉我。
Usage:
massren [OPTIONS]
Application Options:
-n, --dry-run Don't rename anything but show the operation that would have
been performed.
-v, --verbose Enable verbose output.
-c, --config Set or list configuration values. For more info, type:
massren --config --help
-u, --undo Undo a rename operation. Currently delete operations cannot be
undone (though files can be recovered from the trash in OSX
and Windows). eg. massren --undo [path]
-V, --version Displays version information.
Help Options:
-h, --help Show this help message
Examples:
Process all the files in the current directory:
% massren
Process all the JPEGs in the specified directory:
% massren /path/to/photos/*.jpg
Undo the changes done by the previous operation:
% massren --undo /path/to/photos/*.jpg
Set VIM as the default text editor:
% massren --config editor vim
List config values:
% massren --config
类型massren --help --config (或massren -ch )查看可能的配置值和默认值:
Config commands:
Set a value:
% massren --config <name> <value>
List all the values:
% massren --config
Delete a value:
% massren --config <name>
Possible key/values:
editor: The editor to use when editing the list of files.
Default: auto-detected.
use_trash: Whether files should be moved to the trash/recycle bin
after deletion. Possible values: 0 or 1. Default: 1.
include_directories: Whether to include the directories in the file buffer.
Possible values: 0 or 1. Default: 1.
include_header: Whether to show the header in the file buffer. Possible
values: 0 or 1. Default: 1.
Examples:
Set Sublime as the default text editor:
% massren --config editor "subl -n -w"
Don't move files to trash:
% massren --config use_trash 0
需要1.17+
go mod tidy
go build
Massren功能由一个几乎完整的代码覆盖范围的可靠测试套件支持。要运行测试单元,请从源代码目录键入go test -v 。
麻省理工学院许可证(MIT)
版权(c)2013-2025劳伦特
特此免费授予获得此软件副本和相关文档文件副本(“软件”)的任何人,以无限制处理该软件,包括无限制的使用权,复制,复制,修改,合并,合并,发布,分发,分发,分发,订婚,和/或允许软件的副本,并允许对以下条件提供以下条件,以下是以下条件。
上述版权通知和此许可通知应包含在软件的所有副本或大量部分中。
该软件是“原样”提供的,没有任何形式的明示或暗示保证,包括但不限于适销性,特定目的的适用性和非侵权的保证。在任何情况下,作者或版权持有人都不应对任何索赔,损害赔偿或其他责任责任,无论是在合同,侵权的诉讼中还是其他责任,是由软件,使用或与软件中的使用或其他交易有关的。