The dir and ls commands display all files or specified files that are stored on the FTP server, and save them to a local disk.
Parameter | Description | Value |
---|---|---|
remote-filename | Specifies the name and directory of a file stored on the FTP server. | The value is a string of 1 to 64 case-insensitive characters without spaces. |
local-filename | Specifies the name of the local file that saves the FTP server file information. | The value is a string of 1 to 64 case-insensitive characters without spaces. |
Usage Scenario
The following describes differences between the dir and ls commands.
Precautions
The wildcard (*) character can be used in commands dir and ls.
# Display the name or detailed information about a file that is saved in the test directory.
<HUAWEI> ftp 10.137.217.201 Trying 10.137.217.201 ... Press CTRL+K to abort Connected to 10.137.217.201. 220 FTP service ready. User(10.137.217.201:(none)):huawei 331 Password required for huawei. Enter password: 230 User logged in.
[ftp] cd test 250 CWD command successfully. [ftp] dir 200 Port command okay. 150 Opening ASCII mode data connection for *. drwxrwxrwx 1 noone nogroup 0 Mar 24 10:48 . drwxrwxrwx 1 noone nogroup 0 Mar 26 15:52 .. drwxrwxrwx 1 noone nogroup 0 Mar 23 16:04 yourtest -rwxrwxrwx 1 noone nogroup 5736 Mar 24 10:38 backup.txt -rwxrwxrwx 1 noone nogroup 5736 Mar 24 10:38 backup1.txt 226 Transfer complete. [ftp] ls 200 Port command okay. 150 Opening ASCII mode data connection for *. . .. yourtest backup.txt backup1.txt 226 Transfer complete.
# Display the detailed information for the file temp.c, and save the displayed information in file temp1.
[ftp] dir temp.c temp1 200 Port command okay. 150 Opening ASCII mode data connection for temp.c. 226 Transfer complete. [ftp] quit 221 Server closing.
<HUAWEI> more temp1
-rwxrwxrwx 1 noone nogroup 3929 Apr 27 18:13 temp.c
# Display the name of file test.bat, and save the displayed information in file test.
<HUAWEI> ftp 10.137.217.201 Trying 10.137.217.201 ... Press CTRL+K to abort Connected to 10.137.217.201. 220 FTP service ready. User(10.137.217.201:(none)):huawei 331 Password required for huawei. Enter password: 230 User logged in.
[ftp] ls test.bat test 200 Port command okay. 150 Opening ASCII mode data connection for test.bat. 226 Transfer complete. [ftp] quit 221 Server closing.
<HUAWEI> more test
test.bat
Item |
Description |
---|---|
d |
Indicates a directory. If this parameter is not present, the command output indicates a file. |
r |
Indicates that the file or directory can be read. |
w |
Indicates that the file or directory can be modified. |