note 68574 added to function.ftp-nlist

From: Date: Wed, 02 Aug 2006 11:08:36 +0000
Subject: note 68574 added to function.ftp-nlist
Groups: php.notes 
Request: Send a blank email to php-notes+get-115442@lists.php.net to get a copy of this message
This function returns an array with the directory path and all files and subdirs which are in this function ftp_searchdir($conn_id, $dir) { if( !@ftp_is_dir( $conn_id, $dir ) ) { die( 'No such directory on the ftp-server' ); } if( strrchr( $dir, '/' ) != '/' ) { $dir = $dir.'/'; } $dirlist[0] = $dir; $list = ftp_nlist( $conn_id, $dir ); foreach( $list as $path ) { $path = './'.$path; if( $path != $dir.'.' && $path != $dir.'..') { if( ftp_is_dir( $conn_id, $path ) ) { $temp = ftp_searchdir( $conn_id, ($path), 1 ); $dirlist = array_merge( $dirlist, $temp ); } else { $dirlist[] = $path; } } } ftp_chdir( $conn_id, '/../' ); return $dirlist; } ---------------------------------------------------------------------- //Looks if a directory ($dir) is isset //returns true or false function ftp_is_dir( $conn_id, $dir ) { if( @ftp_chdir( $conn_id, $dir ) ) { ftp_chdir( $conn_id, '/../' ); return true; } else { return false; } } ---- Server IP: 217.13.201.10 Probable Submitter: 85.176.50.3 ---- 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-nlist.php Edit -- https://master.php.net/note/edit/68574 Del: integrated -- https://master.php.net/note/delete/68574/integrated Del: useless -- https://master.php.net/note/delete/68574/useless Del: bad code -- https://master.php.net/note/delete/68574/bad+code Del: spam -- https://master.php.net/note/delete/68574/spam Del: non-english -- https://master.php.net/note/delete/68574/non-english Del: in docs -- https://master.php.net/note/delete/68574/in+docs Del: other reasons-- https://master.php.net/note/delete/68574 Reject -- https://master.php.net/note/reject/68574 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115442) next »