From: Sebastien D. <sde...@us...> - 2005-04-22 08:21:56
|
Update of /cvsroot/tslogparser/tslogparser/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31070/admin Added Files: purge.php Log Message: Added a way to empty upload directory --- NEW FILE: purge.php --- <?php /* * Copyright (c) 2005, Bull S.A.. All rights reserved. * Created by: Sebastien Decugis * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston MA 02111-1307, USA. */ /* This file empties the upload directory. Use with care! */ $root="../"; $_PAGE["title"]="TSLP purge"; /* Output header page */ require($root."header.inc.php"); /* We'll need functions defined in other files */ require($root."functions.inc.php"); function rmdirRecursive($path,$followLinks=false) { $dir = opendir($path) ; while ( $entry = readdir($dir) ) { if ( is_file( "$path/$entry" ) || ((!$followLinks) && is_link("$path/$entry")) ) { echo ( "unlink $path/$entry;\n" ); // Uncomment when happy! //unlink( "$path/$entry" ); } elseif ( is_dir( "$path/$entry" ) && $entry!='.' && $entry!='..' ) { rmdirRecursive( "$path/$entry" ) ; } } closedir($dir) ; echo "rmdir $path;\n"; // Uncomment when happy! // return rmdir($path); } rmdirRecursive($root."ts/"); require($root."footer.inc.php"); ?> |