2012-11-30 65 views
0

我想以遞歸方式將一個文件夾內的所有項目複製到其他位置,但我也希望將以「release.php」結尾的文件重命名爲「.php」,並且用這些文件替換舊的「.php」文件,有沒有辦法可以處理每個文件複製項目看到的?所以我可以重命名它?提前致謝。複製項目解析項目

+3

http://whathaveyoutried.com? –

回答

0

嘗試類似的東西?

PS>ls c:\temp -recurse | 
     ForEach-Object { 
     if($_.FullName -match "relase.php"){ 
     Rename-Item $_.FullName -NewName "$($_.baseName).php" -whatif; 
     move-item "$($_.DirectoryName)\$($_.Basename).php" $destination -whatif 
     } 
     else{ 
     move-item $_.Fullname $detination -whatif 
     }