vieyahn2017 / shellv

shell command test and study
4 stars 1 forks source link

批量重命名 #94

Open vieyahn2017 opened 6 months ago

vieyahn2017 commented 6 months ago

批量重命名

vieyahn2017 commented 6 months ago
find . -type f -name "20240223-*"-exec rename 's/20240223-*/20230223-*'{}\\;
vieyahn2017 commented 6 months ago

powershell

Get-ChildItem -Path "your path" -Filter "20240226-*" | foreach {Rename-Item $.FullName -NewName $.Name.Replace("20240226-", "20230101-")}

Get-ChildItem -Path "your path" -Filter "20240226-*" | foreach {Rename-Item $_.FullName -NewName $_.Name.Replace("20240226-", "20230101-")}
vieyahn2017 commented 6 months ago

另外搜到的rename没起作用

 find . -type f -name "20240226-*" -exec rename 's/20240226-*/20230226-*' {} \;

这边说,那是perl版本rename的用法。

批量修改文件名的任意部分 我的rename程序为Perl版本,提供man rename可以查看版本 https://www.cnblogs.com/zenglihan/p/17547099.html