我正在linux/bash中尝试这样做。我有多个目录。我不介意每个人都单独做,因为只有几个。在每个目录中,都有文件和文件夹,其名称如下..。
7-11 WSUS on workstations.png
7-12 1711-pen-FINAL-02_enc.pdf
12-12.txt
7-13.2 AD User selection.xlsx
7-14.2 Server selection.xlsx
7-14 it-vm21-1.png
12.14 it-vm21.png
7.14 Syslog message from 10-35-1-91.doc
7.14 Syslog message from 10-35-1-91.msg
7-16.2 admin request selection.xlsx
7-17.2 Employee hire selection.xlsx
7-17 Contractor List.xlsx最初,我希望这只是文件,但也想知道如何使它适用于包括目录,如果需要的话。我想把第一个催眠曲换成一个句号,这样上面的列表就会像这样。
7.11 WSUS on workstations.png
7.12 1711-pen-FINAL-02_enc.pdf
12.12.txt
7.13.2 AD User selection.xlsx
7.14.2 Server selection.xlsx
7.14 it-vm21-1.png
12.14 it-vm21.png
7.14 Syslog message from 10-35-1-91.doc
7.14 Syslog message from 10-35-1-91.msg
7.16.2 admin request selection.xlsx
7.17.2 Employee hire selection.xlsx
7.17 Contractor List.xlsx不知道从哪里开始。任何帮助都将不胜感激!
发布于 2018-09-06 20:59:41
使用rename命令重命名所有内容:
rename -n 's/-/\./' *档案:
find -maxdepth 1 -type f -exec rename -n 's/-/\./' {} +对于目录:
find -maxdepth 1 -type d -exec rename -n 's/-/\./' {} +当您确信-n选项对您有用时,从命令中删除它。
您还可以根据需要更改-maxdepth。
https://askubuntu.com/questions/1072892
复制相似问题