source: http://daanlenaerts.com/blog/2015/08/18/python-3-upload-files-over-ftp/
FTP is a very popular, and commonly used file transfer protocol. Almost everyone who has a website, has used FTP to put it online. It’s easy to use, fast, and – when using SFTP – secure as well. It can be really useful to be able to transfer files over FTP with a Python script. So that’s what I’ll be doing right now.
First create a new .py file. Let’s start with importing ftplib, which we’ll be using to transfer files.
Next, it’s time to configure the connection to the server. We do this by providing ftplib with the server address, ftp username and password.
After creating our new FTP object, we’ll define the remote directory where the transferred file needs to get stored. We immediately navigate into this folder.
The last piece of code we’ll add will read a local file (“a.txt” in this case) and transfer it to the previously defined remote directory.
That’s already it!
It’s kinda straight-forward, but for your convenience I pasted the full code below:
'Programming' 카테고리의 다른 글
Make your javascript a Windows .exe (0) | 2015.09.02 |
---|---|
(Racket) Upload files over FTP (0) | 2015.08.19 |
Python urllib tutorial for Accessing the Internet (0) | 2015.07.28 |
Reference Counting Garbage Collection (0) | 2015.07.13 |
Microsoft Visual studio 2005 express edition offline installation file (ISO) download. (0) | 2015.06.29 |