note 62669 added to function.ftp-rmdir
| From: | uma at di4 dot com | Date: | Tue, 07 Mar 2006 00:06:07 +0000 |
| Subject: | note 62669 added to function.ftp-rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104945@lists.php.net to get a copy of this message | ||
Removing a directory using FTP(modified Version):
___________________________________________
function ftp_rmAll($conn_id,$dst_dir){
$ar_files = ftp_nlist($conn_id, $dst_dir);
//var_dump($ar_files);
if (is_array($ar_files)){ // makes sure there are files
for ($i=0;$i<sizeof($ar_files);$i++){ // for each file
$st_file = $ar_files[$i];
if($st_file == '.' || $st_file == '..') continue;
if (ftp_size($conn_id, $dst_dir.'/'.$st_file) == -1){ // check if it is a
directory
ftp_rmAll($conn_id, $dst_dir.'/'.$st_file); // if so, use recursion
} else {
ftp_delete($conn_id, $dst_dir.'/'.$st_file); // if not, delete the file
}
}
}
$flag = ftp_rmdir($conn_id, $dst_dir); // delete empty directories
//return $flag;
}
----
Server IP: 216.194.113.175
Probable Submitter: 66.254.86.194
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.ftp-rmdir.php
Edit -- http://master.php.net/note/edit/62669
Del: integrated -- http://master.php.net/note/delete/62669/integrated
Del: useless -- http://master.php.net/note/delete/62669/useless
Del: bad code -- http://master.php.net/note/delete/62669/bad+code
Del: spam -- http://master.php.net/note/delete/62669/spam
Del: non-english -- http://master.php.net/note/delete/62669/non-english
Del: in docs -- http://master.php.net/note/delete/62669/in+docs
Del: other reasons-- http://master.php.net/note/delete/62669
Reject -- http://master.php.net/note/reject/62669
Search -- http://master.php.net/manage/user-notes.php