/*
Author : Evergreenphp
Date : 10-10-2008
Desc : This is will delete all the 'xml' files inside the $path_dir folder
not only that but also this code checks whether the file created before 10 mins
or else that files will not be deleted
h - hour, i - minutes, s - seconds, m - month, d - date of the month, Y - Year
*/
/* Configuration setting starts */
$path_dir = "/www/htdocs/phpdocs/missing_man/general";
$cdate = date("Y-m-d h:i:s",mktime(date("h"), date("i")-10, date("s"), date("m"), date("d"), date("Y")));
$file_type = "txt";
/* Configuration setting ends */
/* Function call */
Delete_file_withtime($path_dir, $cdate, $file_type);
/* Function Definition starts */
function Delete_file_withtime($path_dir, $cdate, $file_type){
$dh = opendir($path_dir);
while (($file = readdir($dh)) !== false) {
$ext_test = explode(".", $file);
echo "
".$date_access = date("Y-m-d h:i:s", fileatime($file));
$stcon_dt = strtotime($date_access);
$encon_dt = strtotime($cdate);
if($file != "." && $file != ".." && $ext_test[1] == $file_type) {
if($encon_dt > $stcon_dt){
//@unlink($file);
echo "success";
}
}
}
}
/* Function Definition ends */
?>
Subscribe to:
Post Comments (Atom)
Popular Posts
-
1. How old PHP language is? - PHP began in 1994, so 14 years old. 2. What are different names of PHP? - PHP originally stood for Persona...
-
HTML: a. HTML is a markup language that is used to build static (non interactive and nonanimated) webpages. b. HTML is Case-Insensitive. So...
-
A payment gateway is an e-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks...
-
Note : This is not a perfect sort order, we have just displaying the list of PHP companies. 1. Photon Infotech No. 2/102, Arvind IT Park (N...
-
- count() -- Count elements in a variable - syntax for count() [int count ( mixed var [, int mode])] - If the optional mode parameter is set...
-
Hai all, Simple show hide sample using Show/Hide? Simple Show/Hide code
-
Sharing PHP, MySQL, Javascript, CSS Knowledge, We can share our PHP knowledge on the basis of PHP versioning, Javascript, AJAX, Stylesheet, ...
-
Use the below code and you can get the exact value in php as us saw in browser. Code: $encode_data = iconv('UTF-8', 'windows-125...
-
Download and Enjoy!
-
A hyperlink is a text or a image that you can click on, and move from one page to another web page. Syntax: < a href= "web pag...
No comments:
Post a Comment