I tried mget * but it only downloads files not folders. Is there a "download all" option?
Asked
Active
Viewed 3,328 times
2 Answers
0
To recursively retrieve directories, you need to use the get -r directive.
From the manpage of SFTP(1):
get [-Ppr] remote-path [local-path]
Retrieve the remote-path and store it on the local machine. If the local path name is not specified, it is given the same name it has on the remote machine. remote-path may
contain glob(3) characters and may match multiple files. If it does and local-path is specified, then local-path must specify a directory.
If either the -P or -p flag is specified, then full file permissions and access times are copied too.
If the -r flag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing recursive transfers.
If this is meant to be run from a scheduled job, you need to add those commands to a batch file and use the -b option.
dawud
- 1,450
- 12
- 18
0
Perhaps the best way is to use wget or curl. Both are available in the CentOS repositories. Both are swiss army knife programs, you'd need to read the manual pages and see which one feels more natural.
vonbrand
- 2,451
- 3
- 21
- 21