How can I get current working directory of FTP using python?
I have the following code and wanted to store file names into the list in the root directory.
from ftplib import FTP
ftp = FTP('domainname.com')
ftp.login(user='username',passwd = 'password')
You can use ftp.pwd
to get current working dir.
Ex:
from ftplib import FTP
ftp = FTP('domainname.com')
ftp.login(user='username',passwd = 'password')
ftp.pwd() #Current working dir
ftp.cwd("Destination_Path") #To change to a different path
MoreInfo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With