Download all files from a sftp server


How i can download ALL files from a sftp server?


I think we need a bit more details from you and what you have tried so far.

You can take a look at sftp package and its examples.

For exemple : I want to connect to the server a which contains the files a aa ab aaa di
and the do pz folder
and download all this files from my go script

Here a good tutorial How to connect to SFTP with Go


yes but no because for that i need to list all file but with this you can t list all file recursivly of a sftp server

So you mean yo would need to process subdirs recursively ? If so, check the listFiles function and when is a directory just call the function again passing the name of the current directory.

1 Like