ftp_dir()

Description:

List all directories and files under the current directory on an FTP server.

Syntax:

ftp_dir(client,multiFiles)

Note:

This is an external library function (See External Library Guide). When parameter multiFiles is a relative path, it is relative to the current working directory; when it is preceded by a slash sign (/), it is an absolute path.

 

For a wildcard character, the question mark (?) signifies a single character, an asterisk (*) signifies any character, and double asterisk (**) signifies any character plus a directory.

Option:

@d

Only list directories; parameter multiFiles is a wildcard-specified server file

@p

List full paths of directories and files; parameter multiFiles is a wildcard-specified server file

@m

Create new directories; parameter multiFiles is a file with fixed name

@r

Delete empty directories; parameter multiFiles is a file with fixed name

Parameter:

client

An FTP server client object

multiFiles

Wildcard-specified server files; can be duplicated

Example:

 

A

 

1

=ftp_open("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/ WorkingDirectory ")

 

3

=ftp_dir@m(A1,"folder1")

Create folder1 directory under the current directory WorkingDirectory.

4

=ftp_dir@m(A1,"folder2","/folder3")

Create folder2 directory under the current directory and create folder3 directory under the root directory.

5

=ftp_dir@r(A1,"folder1")

Delete the empty directory folder1 from the current working directory.

6

=ftp_dir@d(A1,"folder*")

List directories preceded by ‘folder’ in the current working directory.

7

=ftp_dir@d(A1,"/a*/??/**")

List directories preceded by a, and files and directories having subdirectores whose names are less than or equal to two characters.

8

=ftp_dir@p(A1,"folder*")

List directories preceded by ‘folder’ in full path under the current directory.

9

>ftp_close(A1)

 

Related function:

ftp_cd()