FTP: File or directory?

FTP: File or directory?

am 15.08.2009 07:32:52 von Clancy

I have just got access to a new server, and am playing with upload/download procedures. I
looked in the root directory, and see several objects which I assume to be directories.
However I was surprised to find there does not appear to be any command to determine if an
object is a file or directory, either in PHP FTP or plain FTP. I could try to change to
them, or download them, but this seems overkill. Am I overlooking something obvious?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: File or directory?

am 15.08.2009 09:56:33 von Ralph Deffke

can u upload ur own files ?
can u create a directory ?
are u using a ftp client ?

try

ralph_deffke@yahoo.de

"Clancy" wrote in message
news:kjhc85hpub7drihgappifphcboolt9udmc@4ax.com...
> I have just got access to a new server, and am playing with
upload/download procedures. I
> looked in the root directory, and see several objects which I assume to be
directories.
> However I was surprised to find there does not appear to be any command to
determine if an
> object is a file or directory, either in PHP FTP or plain FTP. I could
try to change to
> them, or download them, but this seems overkill. Am I overlooking
something obvious?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: File or directory?

am 15.08.2009 11:33:07 von Ashley Sheridan

On Sat, 2009-08-15 at 09:56 +0200, Ralph Deffke wrote:
> can u upload ur own files ?
> can u create a directory ?
> are u using a ftp client ?
>
> try
>
> ralph_deffke@yahoo.de
>
> "Clancy" wrote in message
> news:kjhc85hpub7drihgappifphcboolt9udmc@4ax.com...
> > I have just got access to a new server, and am playing with
> upload/download procedures. I
> > looked in the root directory, and see several objects which I assume to be
> directories.
> > However I was surprised to find there does not appear to be any command to
> determine if an
> > object is a file or directory, either in PHP FTP or plain FTP. I could
> try to change to
> > them, or download them, but this seems overkill. Am I overlooking
> something obvious?
>
>
>
That answer doesn't seem to quite come close even to answering the op
question.

Have you looked at ftp_rawlist which returns a detailed list of files,
along with their permissions and directory flags? Or you could use
ftp_size to determine the size of a file, which should be nothing for a
directory.

Thanks,
Ash
http://www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: File or directory?

am 16.08.2009 01:45:05 von Clancy

On Sat, 15 Aug 2009 10:33:07 +0100, ash@ashleysheridan.co.uk (Ashley Sheridan) wrote:

>On Sat, 2009-08-15 at 09:56 +0200, Ralph Deffke wrote:
>> can u upload ur own files ?
>> can u create a directory ?

Yes.

>> are u using a ftp client ?

No; I'm using straight PHP FTP
>>
>>
>> "Clancy" wrote in message
>> news:kjhc85hpub7drihgappifphcboolt9udmc@4ax.com...
>> > I have just got access to a new server, and am playing with
>> upload/download procedures. I
>> > looked in the root directory, and see several objects which I assume to be
>> directories.
>> > However I was surprised to find there does not appear to be any command to
>> determine if an
>> > object is a file or directory, either in PHP FTP or plain FTP. I could
>> try to change to
>> > them, or download them, but this seems overkill. Am I overlooking
>> something obvious?
>>
>>
>>
>That answer doesn't seem to quite come close even to answering the op
>question.
>
>Have you looked at ftp_rawlist which returns a detailed list of files,
>along with their permissions and directory flags? Or you could use
>ftp_size to determine the size of a file, which should be nothing for a
>directory.

Thanks,

Yes; I found ftp_rawlist eventually, but I still haven't found a definition of the return
code, though I think I know most of it.

I guess that even a null file will hve some length? I will probably use the leading 'd'
in the return code to test for directories..

(And I spent a long time trying to work out how 'drwxr-xr-x 2 riordan riordan 512 Jul 31
06:40 cgi-bin' could contain lots of spaces, before I remembered that, as a result of one
of the weirder design decisions, HTML suppresses trailing spaces.)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: File or directory?

am 17.08.2009 07:24:05 von George Langley

is_dir()



is_file()



George Langley


On 15-Aug-09, at 5:45 PM, Clancy wrote:

> On Sat, 15 Aug 2009 10:33:07 +0100, ash@ashleysheridan.co.uk (Ashley
> Sheridan) wrote:
>
>> On Sat, 2009-08-15 at 09:56 +0200, Ralph Deffke wrote:
>>> can u upload ur own files ?
>>> can u create a directory ?
>
> Yes.
>
>>> are u using a ftp client ?
>
> No; I'm using straight PHP FTP
>>>
>>>
>>> "Clancy" wrote in message
>>> news:kjhc85hpub7drihgappifphcboolt9udmc@4ax.com...
>>>> I have just got access to a new server, and am playing with
>>> upload/download procedures. I
>>>> looked in the root directory, and see several objects which I
>>>> assume to be
>>> directories.
>>>> However I was surprised to find there does not appear to be any
>>>> command to
>>> determine if an
>>>> object is a file or directory, either in PHP FTP or plain FTP. I
>>>> could
>>> try to change to
>>>> them, or download them, but this seems overkill. Am I overlooking
>>> something obvious?
>>>
>>>
>>>
>> That answer doesn't seem to quite come close even to answering the op
>> question.
>>
>> Have you looked at ftp_rawlist which returns a detailed list of
>> files,
>> along with their permissions and directory flags? Or you could use
>> ftp_size to determine the size of a file, which should be nothing
>> for a
>> directory.
>
> Thanks,
>
> Yes; I found ftp_rawlist eventually, but I still haven't found a
> definition of the return
> code, though I think I know most of it.
>
> I guess that even a null file will hve some length? I will probably
> use the leading 'd'
> in the return code to test for directories..
>
> (And I spent a long time trying to work out how 'drwxr-xr-x 2
> riordan riordan 512 Jul 31
> 06:40 cgi-bin' could contain lots of spaces, before I remembered
> that, as a result of one
> of the weirder design decisions, HTML suppresses trailing spaces.)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: File or directory?

am 18.08.2009 12:00:37 von Clancy

On Sun, 16 Aug 2009 23:24:05 -0600, george.langley@shaw.ca (George Langley) wrote:

>is_dir()
>
>
>
>is_file()
>
>
>
I specifically asked about FTP under PHP. As far as I can see neither of these references
have anything to do with FTP.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: File or directory?

am 18.08.2009 12:30:57 von Ollisso

On Tue, 18 Aug 2009 13:00:37 +0300, Clancy wrote:

> On Sun, 16 Aug 2009 23:24:05 -0600, george.langley@shaw.ca (George
> Langley) wrote:
>
>> is_dir()
>>
>>
>>
>> is_file()
>>
>>
>>
> I specifically asked about FTP under PHP. As far as I can see neither
> of these references
> have anything to do with FTP.
>

http://ca3.php.net/manual/en/wrappers.ftp.php

Supports stat() No As of PHP 5.0.0: filesize(), filetype(), file_exists(),
is_file(), and is_dir() elements only. As of PHP 5.1.0: filemtime().

should work if PHP >= 5.0.0

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: File or directory?

am 18.08.2009 12:33:52 von Ashley Sheridan

On Tue, 2009-08-18 at 13:30 +0300, Ollisso wrote:
> On Tue, 18 Aug 2009 13:00:37 +0300, Clancy wrote:
>
> > On Sun, 16 Aug 2009 23:24:05 -0600, george.langley@shaw.ca (George
> > Langley) wrote:
> >
> >> is_dir()
> >>
> >>
> >>
> >> is_file()
> >>
> >>
> >>
> > I specifically asked about FTP under PHP. As far as I can see neither
> > of these references
> > have anything to do with FTP.
> >
>
> http://ca3.php.net/manual/en/wrappers.ftp.php
>
> Supports stat() No As of PHP 5.0.0: filesize(), filetype(), file_exists(),
> is_file(), and is_dir() elements only. As of PHP 5.1.0: filemtime().
>
> should work if PHP >= 5.0.0
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
That only works if you have used the file wrapper functions to open the
remote FTP connection. Some FTP hosts don't support the use of these
wrappers I believe also.

What is wrong with using ftp_rawlist() ?

Thanks,
Ash
http://www.ashleysheridan.co.uk




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php