[英]how can i recursively rename folders in windows matching string and ignoring case
我有具有名稱的子文件夾:
我想將所有這些重命名為:
在 Windows 中是否有一種簡單的方法(也許在命令提示符中使用 powershell 或其他東西)?
您可以在兩次 Rename-Item 調用中完成此操作。 第一種方法會為每個名稱添加前綴以避免“源路徑和目標路徑必須不同”。 錯誤。 第二次運行將刪除前綴。
Get-ChildItem -Filter original_optimize -Recurse |
Rename-Item -NewName __foo__Original_Optimize -PassThru |
Rename-Item -NewName {$_.Name -replace '^__foo__'} -PassThru
試試這個。
Get-ChildItem C:\path-to-directory -Recurse -Filter *foo* | Rename-Item -NewName { $_.name -replace 'foo', 'bar'} -verbose
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.