PHP Code:
$old = getcwd();
chdir("images");
unlink("something.else");
chdir($old);
you dont need loads of posts from me :P
$old = getcwd();
chdir("images");
unlink("something.else");
chdir($old);
$path = dirname(__FILE__).'/files';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ((time()-filectime($path.'/'.$file)) < 86400) { // auto-deletion every 24 hours
if (strripos($file, '.txt') !== false) { //deletes particular file extension
unlink($path.'/'.$file);
}
}
}
}
$path = dirname(__FILE__).'/files';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ((time()-filectime($path.'/'.$file)) < 86400) { // auto-deletion every 24 hours
if (strripos($file, '.txt') !== false) { //deletes particular file extension
unlink($path.'/'.$file);
}
}
}
}
Leave a comment: