hello Marco Pivetta,
while the implementations you linked indeed works, it also kinda big and
involve changing the error handler just so that it doesn't show the error,
which i think is not the way to do it. i think there should be simple way
to check like "is_dir" or "is_file".
anyway thanks for
Heya KISE,
I just checked a bit around and found that current implementations actually
simply deal with the warning:
https://github.com/rjkip/ftp-php/blob/master/src/FtpPhp/FtpClient.php#L172-L186
https://github.com/rjkip/ftp-php/blob/master/src/FtpPhp/FtpClient.php#L92-L116
What kind of problem
Paul Dragoonis,
Actually it wont work i did tried it before, if the dir end with / it will
list the directories inside the path you gave it and if it doesn't have any
directories it will return false since there is no directories to return.
you have to take out the last / and then remove the dire
An extra parameter is required in the above function, but you get the
point, i don't want to keep spamming the mailing list with corrections :-)
On Fri, Jan 18, 2013 at 3:30 PM, Paul Dragoonis wrote:
> Revised function:
>
> function dir_exists($conn, $currentDir) {
> $list = ftp_nlist(
Revised function:
function dir_exists($conn, $currentDir) {
$list = ftp_nlist($conn, '-dF '. $currentDir);
return in_array($dir, $list);
}
On Fri, Jan 18, 2013 at 3:28 PM, Paul Dragoonis wrote:
>
> On Fri, Jan 18, 2013 at 3:18 PM, KISE wrote:
>
>> $res = ftp_nlist($t
On Fri, Jan 18, 2013 at 3:18 PM, KISE wrote:
> $res = ftp_nlist($this->conn_id, '-dF '. $dir);
>
This could be done in two lines.
function dir_exists($conn, $dir) {
$list = ftp_nlist($conn, '-dF '. $dir);
return in_array($dir, $list);
}
Will Fitch, sorry i didn't know that i contacted one of the dev to post it
on behalf of me and he said its ok to post here, i'll post it there right
away
Paul Dragoonis, there is 3 ways to do it in userland codes.
Public function dir_exists($dir)
{
if (!$this->conn_id)
I don't believe there's a feature of the FTP protocol to check if a
file/folder exists.
Can you please provide a PHP userland solution to this, so that a
corresponding C implementation could be added.
I believe the way to go about it is list the CWD contents and check if that
exists and is of typ
On Jan 18, 2013, at 9:53 AM, KISE wrote:
> Hi
>
> II would like to see "ftp_dir_exists()" function in PHP, right now its
> kinda unreasonable to expect people to use hacks such as "is_dir()" and
> having to re-authenticate just to check if the dir exists, I also dont
> think its good idea to us