zoukankan      html  css  js  c++  java
  • linux_rename命令用法

    rename在man中的解释为:

    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.
    
    EXAMPLES
           Given the files foo1, ..., foo9, foo10, ..., foo278, the commands
    
                  rename foo foo0 foo?
                  rename foo foo0 foo??
    
           will turn them into foo001, ..., foo009, foo010, ..., foo278.  And
    
                  rename .htm .html *.htm
    
           will fix the extension of your html files.
    
    WARNING
           The  renaming has no safeguards.  If the user has permission to rewrite file names, the command will perform the action without any questions.  For example,
           the result can be quite drastic when the command is run as root in the /lib directory.  Always make a backup before running the command,  unless  you  truly
           know what you are doing.
    
    SEE ALSO
           mmv(1), mv(1)

    其参数为三个,而不是两个

    mv指令也可以更改文件名,但是只能一个一个更改 

    rename命令提供了批量更改的渠道

    用法如下:

    比如一个文件夹下有如下文件

    20190328. 20190329. 20190330. 20190331. 20190401. 20190402. 20190403. 20190404. 20190405. 20190406. 20190407. 20190408. 20190409.

    我要把每个文件后面的“.”置换成“.txt”则只需执行如下命令

    rename . .txt *.

    这样就 okl

    “*”是通配符,还有“?”是代表一个字符

    希望对大家有所帮助

    以上

  • 相关阅读:
    CentOS 下搭建Jenkins
    SRVE0255E: 尚未定义要处理 ***的 Web 组/虚拟主机。
    WebSphere Application Server中manageprofiles的使用
    WAS 与IHS集成问题
    CentOS ln 链接
    VIM常见命令
    虚拟机VM下CentOS7部署WASND9+HTTP9
    CentOS7下安装GUI图形界面
    CentOS 系统时间与硬件时间
    hive 排序和聚集
  • 原文地址:https://www.cnblogs.com/lavender-pansy/p/10674733.html
Copyright © 2011-2022 走看看