dir/ls (FTP client view)
Function
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.
Parameters
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 Guidelines
Usage Scenario
The following describes differences between the dir and ls commands.
- After you run the dir command, detailed file information is displayed, including the file size, date when the file is created, whether the file is a directory, and whether the file is editable. After you run the ls command, only the file name is displayed.
- The dir command is used to save detailed file information, while the ls command is used to save only the file name even if the file is specified and saved in a local directory.
Precautions
The wildcard (*) can be used in commands dir and ls.
Example
# Display the name or detailed information about a file that is saved in the test directory.
<AC6605> 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.
[AC6605-ftp] cd test 250 CWD command successfully. [AC6605-ftp] dir 200 Port command okay. 150 File Listing Follows in ASCII mode 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 finished successfully. [AC6605-ftp] ls 200 Port command okay. 150 File Listing Follows in ASCII mode yourtest backup.txt backup1.txt 226 Transfer finished successfully. FTP: 10 byte(s) received in 0.110 second(s) 90.90byte(s)/sec.
# Display the detailed information in file temp.c, and save the displayed information in file temp1.
[AC6605-ftp] dir temp.c temp1 200 PORT command okay 150 File Listing Follows in ASCII mode \ 226 Transfer finished successfully. FTP: 62 byte(s) received in 0.050 second(s) 1.24Kbyte(s)/sec. [AC6605-ftp] quit 221 Windows FTP Server (WFTPD, by Texas Imperial Software) says goodbye
<AC6605> 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.
<AC6605> 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.
[AC6605-ftp] ls test.bat test 200 Port command okay. 150 Opening ASCII mode data connection for test.bat. 226 Transfer complete. [AC6605-ftp] quit 221 Server closing.
<AC6605> more test
test.bat
Parameter |
Description |
---|---|
d in the command output |
Indicates a directory. If there is no output for this parameter, the command output indicates a file. |
r in the command output |
Indicates that the file or directory can be read. |
w in the command output |
Indicates that the file or directory is editable. |