Quote:
Originally Posted by bigalownz
yes thats what im looking for
but i dont know how to write a php script like that
|
Here you go, just remember to change the DIR_HERE to the directory the files are in (e.g. /home/user/public_html/filedirectory/):
PHP Code:
<?php
## Variables
# Directory
$dir = "DIR_HERE";
## Code
if($handle = opendir($dir)) {
print "<p>Processing files...</p>";
# Loop through files in dir
while(false !== ($file = readdir($handle))) {
# Get file data
$data = file_get_contents($file);
# Write data back to file
$fp = fopen($file, "w");
fwrite($fp, $data);
fclose($fp);
# Give output
print "<p>Done "".$file.""</p>";
}
# Close dir
closedir($handle);
}
print "<br /><p>Finished</p>"
?>