I looked around for some other ways to do this but decided to just code this up in Python. It connects to a remote Linux server using ftp and recursively copies all the files and directories back to a Windows machine.
Here is the source:
This is an example of the ease of use of Python for quick scripting. It uses a low-level ftp library called ftplib.
Bobby
About Bobby
I live in Chandler, Arizona with my wife and three daughters. I work for US Foods, the second largest food distribution company in the United States. I have worked in the Information Technology field since 1989. I have a passion for Oracle database performance tuning because I enjoy challenging technical problems that require an understanding of computer science. I enjoy communicating with people about my work.
Hi Bobby,
Thanks for posting this – we use sftp and certificates – could this script be modified for that?
Thanks
Steve
Steve,
Thank you for your comment. I think that you would use the paramiko (ssh) library to do sftp. http://www.paramiko.org/. I had a paramiko example in an earlier post – https://www.bobbydurrettdba.com/2017/09/13/python-for-the-oracle-dba-connects-to-everything/. I used simple password authentication to use ssh to run shell commands but I’m pretty sure that paramiko supports all of the stuff with certificates that ssh/sftp does. I have not tried it but I think that library will do what you asked about.
Bobby
Sftp version: https://www.bobbydurrettdba.com/2018/05/30/python-script-to-backup-remote-directory-using-sftp/