View Single Post
Old 06-04-2008, 05:57 AM  
testpie
Mostly retired
 
testpie's Avatar
 
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
Quote:
Originally Posted by bigalownz View Post
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 &quot;".$file."&quot;</p>";
 }
 
# Close dir
 
closedir($handle);
}
print 
"<br /><p>Finished</p>"
?>
__________________

Affiliates: DogFart ~ Domain parking: NameDrive ~ Traffic broker: Traffic Holder
testpie is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote