UAd*_*ter 16 command-line bash file-extension
我想为所有文件添加 .zip 扩展名。我试过这个,但它不起作用:
ls | awk '{print $1 " " $1".zip"}' | xargs mv -f
Run Code Online (Sandbox Code Playgroud)
Ado*_*obe 18
rename 's/$/\.zip/' *
Run Code Online (Sandbox Code Playgroud)
不要xargs用于那个!
一个非常简单的方法是:
如果您想保留当前扩展名:
for i in *; do mv $i ${i}.zip; done
Run Code Online (Sandbox Code Playgroud)
如果你想替换当前的扩展:
for i in *; do mv $i ${i%.*}.zip; done
Run Code Online (Sandbox Code Playgroud)
搜索 - 几个链接:
男人改名:
NAME
rename - renames multiple files
SYNOPSIS
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]
DESCRIPTION
"rename" renames the filenames supplied according to the rule specified as
the first argument. The perlexpr argument is a Perl expression which is
expected to modify the $_ string in Perl for at least some of the filenames
specified. If a given filename is not modified by the expression, it will not
be renamed. If no filenames are given on the command line, filenames will be
read via standard input...
Run Code Online (Sandbox Code Playgroud)
人维基:http : //en.wikipedia.org/wiki/Man_page
| 归档时间: |
|
| 查看次数: |
36868 次 |
| 最近记录: |