次のスニペットを使用して、フォルダー内のすべての画像ファイルのファイル拡張子を変更しようとしています。
$dh = opendir('JS2C');
$files = array();
while (($file = readdir($dh)) !== false) {
if($file !== '.' && $file !== '..') {
$file = pathinfo($file);
rename($file, $new . '.jpg');
}
}
次の警告メッセージが表示されます。
SCREAM: Error suppression ignored for
Warning: rename(ANAZODO.gif,ANAZODO.jpg):
The system cannot find the file specified. (code: 2) in C:\wamp2\www\ckcportal\batch2.php on ...
ファイルを含むフォルダーは、PHP
スクリプトと同じフォルダーにあります。