Apr-13-2024, 05:02 AM
(This post was last modified: Apr-13-2024, 05:02 AM by Pedroski55.)
Just a suggestion, I have never done this and I have no intranet to try this on.
I think you need to download the file from the first ftp address to your local machine, then upload the file from your local machine to the other ftp address.
You must be working from somewhere!
I think you need to download the file from the first ftp address to your local machine, then upload the file from your local machine to the other ftp address.
You must be working from somewhere!
from ftplib import FTP # get a file from 10.41.200.21 ftp = FTP('10.41.200.21') ftp.login('USERNAME','PASSWORD') ftp.cwd('/where/my/file/is/') # list current files & directories ftp.dir() # where are you working from? Where to put the file? with open('/my/local/machine/myfile.sth', 'wb') as fp: ftp.retrbinary('RETR afile.sth', fp.write) ftp.quit() # put a file in 10.41.101.25 ftp2 = FTP('10.41.101.25') ftp2.login('USERNAME','PASSWORD') ftp2.cwd('/where/my/file/goes/') # local file name you want to upload # where are you working from? filename = '/my/local/machine/myfile.sth' with open(filename, "rb") as file: # use FTP's STOR command to upload the file ftp2.storbinary(f"STOR {filename}", file) # list current files & directories ftp2.dir() ftp2.quit()Maybe you can miss the step where you save the file on your local machine and directly upload the binary to ftp2? Try it!