Page 1 of 1

$fileTypes='*.png';

Posted: Wed Feb 03, 2010 4:51 pm
by bajere
hi all,

im sure this is very simple, but im not to quick on php code...
how do i add more file types to the .png.

thanks in advance.

grant

Code: Select all

 
 
<?php
$expiretime=1; //expire time in minutes
 
$tmpFolder="stuff/";
 
$fileTypes='*.png';
 
foreach (glob($tmpFolder . $fileTypes) as $Filename) {
 
// Read file creation time
$FileCreationTime = filectime($Filename);
 
// Calculate file age in seconds
$FileAge = time() - $FileCreationTime;
 
// Is the file older than the given time span?
if ($FileAge > ($expiretime * 60)){
 
// Now do something with the olders files...
 
//print "The file $Filename is older than $expire_time minutes\n";
 
//deleting files:
unlink($Filename);
}
 
}
?>
 
 
 
 

Re: $fileTypes='*.png';

Posted: Wed Feb 03, 2010 5:52 pm
by AbraCadaver
Read the glob() page: http://us3.php.net/manual/en/function.glob.php Especially the GLOB_BRACE flag.

Re: $fileTypes='*.png';

Posted: Thu Feb 04, 2010 3:54 am
by bajere
AbraCadaver wrote:Read the glob() page: http://us3.php.net/manual/en/function.glob.php Especially the GLOB_BRACE flag.

Thanks for the link mate, but i have no idea what it all means. i found the code i have at the moment just to help someone out. we need to click a button on a web page to delete certain files on the server in a certain folder.... do you know of any ways to do this?

cheers