0
我有一塊軟件,它尋找名爲「report.txt」的文件。但是,這些文本文件並不都是名爲report.txt,並且我有數百個子文件夾可以通過。重命名項目在多個子文件夾
場景:
J:\Logs
26-09-16\log.txt
27-09-16\report270916.txt
28-09-16\report902916.txt
我想通過所有的子文件夾搜索文件*.txt
在J:\logs
,並將其重命名爲report.txt
。
我試過,但它抱怨道:
Get-ChildItem * |
Where-Object { !$_.PSIsContainer } |
Rename-Item -NewName { $_.name -replace '_$.txt ','report.txt' }
感謝,這正是我想要的。 :) – Andy