I have subfolders which have names:
I would like to rename all of these to:
Is there an easy way of doing this in windows (perhaps using powershell or something in command prompt ) ?
You can do that in two Rename-Item calls. The first would add a prefix to each name to avoid the 'Source and destination path must be different.' error. The second run will remove the prefix.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.