note 61270 deleted from function.ftp-nlist by aidan
| From: | aidan@php.net | Date: | Mon, 30 Jan 2006 06:47:07 +0000 |
| Subject: | note 61270 deleted from function.ftp-nlist by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102712@lists.php.net to get a copy of this message | ||
Note Submitter: sakinlesh at yahoo dot com
Reason: useless
----
<?
// full_ftp_rmdir // sakinlesh
if ($path){
// FTP info
$server='server';
$user = "user";
$pass = "pass";
// FTP connect
$ftp_stream = ftp_connect($server);
$result = ftp_login($ftp_stream, $user, $pass);
// full_ftp_rmdir function
function full_ftp_rmdir($ftp_stream,$path){
// main path $mainpath = '/';
$mainpath = "main_file";
$arr_dosya = array();
//is file?
if(is_dir($path)) {
// file's info to $contents
if($contents = opendir($path)) {
// $contents to $node
while(($dosya = readdir($contents)) !== false) {
if (!is_dir($dosya)){
array_push($arr_dosya,$dosya);
}//end if
}//end while
}//end if
}//end if
foreach ($arr_dosya as $dos){
// dir's full path
$silinecek = $mainpath.'/'.$path.'/'.$dos;
// file's full path
@ftp_delete($ftp_stream, $silinecek);
// continue
listele($ftp_stream, $path.'/'.$dos);
}// all files deleted
// del empty dir
@ftp_rmdir($ftp_stream, $mainpath.'/'.$path);
}
full_ftp_rmdir($ftp_stream, $path);
// check
if (is_dir($path)){ echo 'deleted';}else{ echo 'not deleted';}
ftp_close($ftp_stream);
}
?>