Name

List

Synopsis

$FTP->List([pattern, listmode])
$FTP->Ls([pattern, listmode])
$FTP->Dir([pattern, listmode])

Returns a list containing the files found in the current directory, matching the given pattern, if specified. The content of the returned list depends on the listmodeparameter, which can have the following values:

1 (default)

The list contains the names of the files found.

2

The list contains seven values for each file:

  • The filename

  • The DOS short filename, a.k.a. 8.3

  • The size

  • The attributes

  • The creation time

  • The last access time

  • The last modified time

3

The list contains a reference to a hash for each found file. Each hash contains the following key/value pairs:

name => filename
altname => DOS short filename, a.k.a. 8.3
size => size
attr => attributes
ctime => creation time
atime => last access time
mtime => last modified time

All times are reported as strings of the following format: second, hour, minute, day, month, year. For example:

$file->{'mtime'} == "0,10,58,9,12,1996"
# Stands for 09 Dec 1996 at 10:58:00

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.