重命名-n选项似乎在cygwin下不可用

时间:2015-07-24 09:34:40

标签: regex unix cygwin rename

我正在尝试使用 cygwin 一次重命名多个文件,并希望使用rename命令。 我想使用-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.

感谢任何建议。

1 个答案:

答案 0 :(得分:1)

Cygwin rename计划来自util-linux,请参阅man rename的底部:

  

rename命令是util-linux软件包的一部分,可用   来自ftp://ftp.kernel.org/pub/linux/utils/util-linux/

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

相关问题