php로 간단하게 디렉토리와 파일 다루기

<?php
if($handle = opendir(‘.’)){
$i = 0;
while(false !==($entry = readdir($handle))){
if($entry != ‘.’ && $entry != ‘..’ && $entry != ‘this_file.php’){
$i ++;
$tno = explode(“.”,$entry);
$no = $tno[0];
$html = “여기에 파일의 내용을 넣는다. 파일의 이름이 필요하다면 $no 배열을 사용하자.”;
$fp=fopen($entry, “w+”);
fputs($fp,$html);
fclose($fp);
}
}
}