FTP Library Package 1.2 for Tcl/Tk Manual Pages

FTP::List  ?directory?
The FTP::List command lists the contents of the current remote directory or if the directory parameter is specified a directory or other group of files. Also wildcard expression, such as "*.tcl", can be specified. The directory or file name must be fully qualified, otherwise the it takes entries in the current remote directory.

The listing includes any system-dependent information that the server chooses to include; for example, most UNIX systems produce output from the command "ls -l". FTP::List returns these information as a tcl list with one line for every entry. Empty lines and UNIX's "total" lines are ignored. So it should offer only usable informations.

If the command fails an empty list is returned.

# list the contents of current directory
foreach line [FTP::List]
	puts $line

# list only tcl files
foreach line [FTP::List *.tcl]
	puts $line

# list specified directory
set dir_list [FTP::List /pub/usr/lib]

#  list all directories recursively
set dir_list [FTP::List -R]

# list if directory exist
if [FTP::Cd /pub/usr/lib] {
	set dir_list [FTP::List]
} else {
	puts "Directory doesn't exist!"

[Contents]  [Previous: FTP::Type]  [Next: FTP::NList]

© 1999 Steffen Traeger