You can use the wget
utility to recursively download all directories and files from an FTP server. To do this, you need to use the -r
or --recursive
option, which allows wget
to follow and download all files and directories in the FTP server. You can also use the -np
or --no-parent
option to avoid downloading files from parent directories, so that only files from the specified directory and its subdirectories are downloaded.
Here’s an example of how you can use wget
to download all files and directories from an FTP server:
wget -r -np ftp://ftp.example.com/directory/
The -r
option enables recursive download, while the -np
option disables download of files from parent directories. The above example downloads all files and directories from the directory
directory on the FTP server at ftp.example.com
.
You can also specify username and password for the FTP server if the server requires authentication:
wget -r -np --ftp-user=username --ftp-password=password ftp://ftp.example.com/directory/
Note that you should use wget
with caution when downloading large amounts of data from an FTP server, as it can consume a significant amount of bandwidth.