我尝试使用此代码重命名我的文件(昨天日期)1、文件(昨天日期)2,3,4,5...。
#!/bin/bash
echo dir date?
read datedir
cd /mnt/c/Users/OPS\ 1/Desktop/F/CVS/CVS\ COMPONENTS/CVS$datedir
echo date now?
read datetd
echo last date?
read lastdate
rename -v 's/$lastdate/$datetd/g' *$lastdate
最佳答案
阅读man rename
后,我明白你想要做什么:
您的rename
命令使用错误。使用以下内容更新它:
rename "$lastdate" "$datetd" *$lastdate
SYNOPSIS:
rename from to file...
DESCRIPTION:
rename
will rename the specified files by replacing the first occurrence offrom
in their name byto
.source:
man rename
关于linux - Linux bash 中的多重重命名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53203348/