im new to python and love it but find it hard to find basic guides.. hopefully someone can help!
anyways i managed to connect to ftp but i cannot find how to download a Directory and files..
i have managed to create a script to copy local fiiles beween harddrives but i dont know the path syntax for ftp..
this is what i have for local backup
src = ('E:\\ITCIRCLECONSULT\\')
dst = ('D:\\COPY\\' +
newFolderName.strftime('%d-%B-%y\\').upper())
i know it will be simple but the simple things are hard to find!
import ftplib
from ftplib import FTP
ftp = FTP('ftp.xxxxxx.com')
ftp.login('username', 'password')
ftp.retrlines('LIST')
ftp.cwd("/public_html")
file_list = []
filenames = ftp.nlst()
ftp.close()
Edit to Add..
I have laid it out the way i want it to work, user inputs data.. Alas, it does not work.
The script skips through the user input and produces an error..
The aim here is to allow the user to input the various information to be called into the ftp carry on before attempting to connect..
any help appreciated.. guidance and tutorage! :)
import ftplib
from ftplib import FTP
ftp_add = input('ftp address:')
username = input('username:')
password = input('password:')
ftp = FTP(ftp_add)
ftp.login(username, password)
ftp.retrlines('LIST')
ftp.cwd("/public_html")
file_list = []
filenames = ftp.nlst()
ftp.close()