Question

I have two ftp servers with fxp enabled on both, I'm just wondering how I would transfer a file between the two servers in Python? I was told curl wouldnt do it, but maybe ftplib will do.

so, the file (file.txt) is in '/personal/' FTP1 and I want to transfer that to FTP2 also to the same place, '/personal/'

Any ideas on how to do this?

Was it helpful?

Solution

The simplest thing to is call the shell from within python, and then scp your file from one computer to the other. It shouldn't be very costly, almost nothing compared with the transfer costs, so don't worry about performance.

Just try

os.system('scp myfile othermachine.jack.com:/transfers')

Or something of the sort. See the documentation of scp. On Windows, you'll need CYGWIN for this.

Of course you can also go for ftp-style copies. Just set up an Apache on the target machine where you can write. But I'd go for the scp solution :)

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top