Page 1 of 1

ftp_rawlist can you test?

Posted: Thu Jun 14, 2007 7:28 pm
by alex.barylski
Does the output of that function change with each operating system? I have tested on a Unix/Linux machine and the format is clear. Can someone test on a Windows server and tell me what it says?

The exact format would be dandy. :)

I need to parse the damn thing. :(

Hopefully some regex trickery will work fine.

Posted: Thu Jun 14, 2007 11:42 pm
by Benjamin
Change your avatar. It makes me not want to respond to any of your comments. I don't play peekaboo.

Posted: Thu Jun 14, 2007 11:49 pm
by John Cartwright
While that was mildly inappropriate and off-topic, :lol:

Posted: Fri Jun 15, 2007 12:01 am
by Benjamin
On a serious note, I went ahead and read the php.net page about that function and it didn't mention anything regarding different operating systems. I can't see it returning different results anyway.. FTP is a protocol, regardless of your OS it should not change.

I think it's safe to say results would be the same considering your version of PHP regardless of the OS your running PHP on or the OS of the FTP server.

Posted: Fri Jun 15, 2007 6:41 am
by volka
There are different ftp implementations with different listing result.
e.g.
FileZilla/FtpListResult.cpp wrote:

Code: Select all

#ifdef LISTDEBUG
	//It's the normal UNIX format (or even another nonstandard format)
	//Some samples are from http://cr.yp.to/ftpparse/ftpparse.c
	/* UNIX-style listing, without inum and without blocks */
		
	static char data[][110]={
		"-rw-r--r--   1 root     other        531 Jan 29 03:26 01-unix-std file",
		"dr-xr-xr-x   2 root     other        512 Apr  8  1994 02-unix-std dir",
		"dr-xr-xr-x   2 root                  512 Apr  8  1994 03-unix-nogroup dir",
		"lrwxrwxrwx   1 root     other          7 Jan 25 00:17 04-unix-std link -> usr/bin",
		
		/* Some listings with uncommon date/time format: */
		"-rw-r--r--   1 root     other        531 09-26 2000 05-unix-date file",
		"-rw-r--r--   1 root     other        531 09-26 13:45 06-unix-date file",
		"-rw-r--r--   1 root     other        531 2005-06-07 21:22 07-unix-date file",
		
		/* Unix style with size information in kilobytes */
		"-rw-r--r--   1 root     other  34.5k Oct 5 21:22 08-unix-namedsize file",

		/* Also NetWare: */
		"d [R----F--] supervisor            512       Jan 16 18:53    09-netware dir",
		"- [R----F--] rhesus             214059       Oct 20 15:27    10-netware file",
		
		/* Also NetPresenz for the Mac: */
		"-------r--         326  1391972  1392298 Nov 22  1995 11-netpresenz file",
		"drwxrwxr-x               folder        2 May 10  1996 12-netpresenz dir",

		/* A format with domain field some windows servers send */
		"-rw-r--r--   1 group domain user 531 Jan 29 03:26 13-unix-domain file",

		/* EPLF directory listings */
		"+i8388621.48594,m825718503,r,s280,\t14-eplf file",
		"+i8388621.50690,m824255907,/,\t15-eplf dir",

		/* MSDOS type listing used by IIS */
		"04-27-00  12:09PM       <DIR>          16-dos-dateambigious dir",
		"04-14-00  03:47PM                  589 17-dos-dateambigious file",

		/* Another type of MSDOS style listings */
		"2002-09-02  18:48       <DIR>          18-dos-longyear dir",
		"2002-09-02  19:06                9,730 19-dos-longyear file",

		/* Numerical Unix style format */
		"0100644   500  101   12345    123456789       20-unix-numerical file",

		/* This one is used by SSH-2.0-VShell_2_1_2_143, this is the old VShell format */
		"206876  Apr 04, 2000 21:06 21-vshell-old file",
		"0  Dec 12, 2002 02:13 22-vshell-old dir/",

		/* This type of directory listings is sent by some newer versions of VShell
		 * both year and time in one line is uncommon.
		 */
		"-rwxr-xr-x    1 user group        9 Oct 08, 2002 09:47 23-vshell-new file",

		/* Next ones come from an OS/2 server. The server obviously isn't Y2K aware */
		"36611      A    04-23-103  10:57  24-os2 file",
		" 1123      A    07-14-99   12:37  25-os2 file",
		"    0 DIR       02-11-103  16:15  26-os2 dir",
		" 1123 DIR  A    10-05-100  23:38  27-os2 dir",

		/* Some servers send localized date formats, here the German one: */
		"dr-xr-xr-x   2 root     other      2235 26. Juli, 20:10 28-datetest-ger dir",
		"-r-xr-xr-x   2 root     other      2235 2.   Okt.  2003 29-datetest-ger file",
		"-r-xr-xr-x   2 root     other      2235 1999/10/12 17:12 30-datetest file",
		"-r-xr-xr-x   2 root     other      2235 24-04-2003 17:12 31-datetest file",

		/* Here a Japanese one: */
		"-rw-r--r--   1 root       sys           8473  4\x8c\x8e 18\x93\xfa 2003\x94\x4e 32-datatest-japanese file",

		/* VMS style listings */
		"33-vms-dir.DIR;1  1 19-NOV-2001 21:41 [root,root] (RWE,RWE,RE,RE)",
		"34-vms-file;1       155   2-JUL-2003 10:30:13.64",

		/* VMS style listings without time */
		"35-vms-notime-file;1    2/8    15-JAN-2000    [IV2_XXX]   (RWED,RWED,RE,)",
		"36-vms-notime-file;1    6/8    15-JUI-2002    PRONAS   (RWED,RWED,RE,)",

		/* VMS multiline */
		"37-vms-multiline-file;1\r\n170774/170775     24-APR-2003 08:16:15  [FTP_CLIENT,SCOT]      (RWED,RWED,RE,)",
		"38-vms-multiline-file;1\r\n10			     2-JUL-2003 10:30:08.59  [FTP_CLIENT,SCOT]      (RWED,RWED,RE,)",

		/* IBM AS/400 style listing */
		"QSYS            77824 02/23/00 15:09:55 *DIR 39-ibm-as400 dir/",
		"QSYS            77824 23/02/00 15:09:55 *FILE 40-ibm-as400-date file",

		/* aligned directory listing with too long size */
		"-r-xr-xr-x longowner longgroup123456 Feb 12 17:20 41-unix-concatsize file",

		/* short directory listing with month name */
		"-r-xr-xr-x 2 owner group 4512 01-jun-99 42_unix_shortdatemonth file",

		/* the following format is sent by the Connect:Enterprise server by Sterling Commerce */
		"-C--E-----FTP B BCC3I1       7670  1294495 Jan 13 07:42 43-conent file",
		"-C--E-----FTS B BCC3I1       7670  1294495 Jan 13 07:42 44-conent-file",

		"-AR--M----TCP B ceunix      17570  2313708 Mar 29 08:56 45-conent-file",

		/* Nortel wfFtp router */
		"46-nortel-wfftp-file       1014196  06/03/04  Thur.   10:20:03",

		/* VxWorks based server used in Nortel routers */
		"2048    Feb-28-1998  05:23:30   47-nortel-vxworks dir <DIR>",

		/* IBM MVS listings */
		// Volume Unit    Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname
		"  WYOSPT 3420   2003/05/21  1  200  FB      80  8053  PS  48-MVS.FILE",
		"  WPTA01 3290   2004/03/04  1    3  FB      80  3125  PO  49-MVS.DATASET",
		"  TSO004 3390   VSAM 50-mvs-file",
		"  TSO005 3390   2005/06/06 213000 U 0 27998 PO 51-mvs-dir",

		/* Dataset members */
		// Name         VV.MM   Created      Changed       Size  Init  Mod Id
		// ADATAB /* filenames without data, only check for those on MVS servers */
		"  52-MVSPDSMEMBER 01.01 2004/06/22 2004/06/22 16:32   128   128    0 BOBY12",

		"53-MVSPDSMEMBER2 00B308 000411  00 FO        RU      31    ANY",
		"54-MVSPDSMEMBER3 00B308 000411  00 FO        RU      ANY    24",

		// Some asian listing format. Those >127 chars are just examples
		"-rwxrwxrwx   1 root     staff          0 2003   3\xed\xef 20 55-asian date file",
        "-r--r--r-- 1 root root 2096 8\xed 17 08:52 56-asian date file",

		// VMS style listing with a different field order
		"57-vms-alternate-field-order-file;1   [SUMMARY]    1/3     2-AUG-2006 13:05  (RWE,RWE,RE,)",

		""};

#endif
But I've pinged 90 ftp servers from the gentoo mirror list and they all reported as "UNIX" ;)

Posted: Fri Jun 15, 2007 12:45 pm
by alex.barylski
astions wrote:Change your avatar. It makes me not want to respond to any of your comments. I don't play peekaboo.
Hahahaha... :D

it's the only photo I have...it's on my facebook and mySpace...it gets attention...good or bad. :)

I'll look into changing it for you if I can find some time today.

volka: YOU ARE THE MAN!!!

I didn't even think about looking into an existing FTP client. Brilliant! ;)

Posted: Fri Jun 15, 2007 3:17 pm
by Benjamin
Icky, looks like could easily vary per server.. not too much fun to parse.