I'm trying to download several folders from an ftp server with Python 3 using ftplib.
I have a list of the names of the folders. They are all located in a folder 'root'. The problem is that I don't know how to navigate through them. When I use cwd
I can go to a deeper directory, but how do I get up again?
I'm trying to get something like
list = ["folder1", "folder2", "folder3"]
for folder in list:
##navigate to folder
##do something
You can retrieve current directory using
FTP.pwd
method. Remember that directory before change directory.I made some changes to code I found here
You have to make the destination folder before running the code. Also, the site I used did not require username or pass.
Please let me know if this works. I am wondering if I should "put this in my back pocket" and save it to my external hard drive.