2013-10-24 44 views

回答

2

你可以嘗試這樣的事:

<?php 
    if ($handle = opendir('/MYfolder')) { 
     while (false !== ($fileName = readdir($handle))) { 
      rename($fileName, $filename.'xml'); 
     } 
     closedir($handle); 
    } 
?> 
+0

'假==($文件名= READDIR ($ handle))'這很有趣。我一直在使用'strpos($ fileName,'。')!== 0',我猜它是做同樣的事情。 – Popnoodles

+0

我看到:)。我希望你得到輸出。 –

+0

我也試過這之前also.i再次嘗試..我知道代碼是正確的,但它沒有這樣做..只是感謝支持:) – aimme

1

在Linux/Unix下:

exec('for F in your/directory/*; do mv $F{,.xml}; done');