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勞倫特
特此免費授予獲得此軟件副本和相關文檔文件副本(“軟件”)的任何人,以無限制處理該軟件,包括無限制的使用權,複製,複製,修改,合併,合併,發布,分發,分發,分發,訂婚,和/或允許軟件的副本,並允許對以下條件提供以下條件,以下是以下條件。
上述版權通知和此許可通知應包含在軟件的所有副本或大量部分中。
該軟件是“原樣”提供的,沒有任何形式的明示或暗示保證,包括但不限於適銷性,特定目的的適用性和非侵權的保證。在任何情況下,作者或版權持有人都不應對任何索賠,損害賠償或其他責任責任,無論是在合同,侵權的訴訟中還是其他責任,是由軟件,使用或與軟件中的使用或其他交易有關的。