rename -n 选项在 cygwin 下似乎不可用

rename -n option seems not available under cygwin

我正在尝试使用 cygwin 一次 重命名 多个文件,并且想使用重命名命令。 我想使用 -n 选项...没有任何操作。这对我来说感觉更省心,因为我不是正则表达式大师。

我找到了有用的资源,他们告诉我应该有这个选项:

-n, --no-act    No Action: show what files would have been renamed.

我正在使用 cygwin,当我显示重命名手册时,-n 选项似乎不可用:

RENAME(1)                                                                           User Commands                                                                           RENAME(1)

NAME
       rename - rename files

SYNOPSIS
       rename [options] expression replacement file...

DESCRIPTION
       rename will rename the specified files by replacing the first occurrence of expression in their name by replacement.

OPTIONS
       -v, --verbose
              Give visual feedback which files where renamed, if any.

       -V, --version
              Display version information and exit.

       -s, --symlink
              Peform rename on symlink target

       -h, --help
              Display help text and exit.

如有任何建议,我们将不胜感激。

Cygwinrename程序来自util-linux,见man rename底部:

The rename command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.

在某些(大多数?)Linux 发行版中 rename 是一个简短的 Perl 脚本。如果您在 Cygwin 安装上安装了 Perl,只需复制 rename 脚本并 运行 它。