Python code to manage files over FTP socket using ftplib . This code is using command line interfaces, for now.
Note: This is tested for Python 2.7. Have yet to test it on Python 3.x.
Before you can manage file, you need to specify the FTP IP address and login credentials.
v0.1
- Base project
v0.1.1
- Added PWD
- Making it usable for Python 3.x. As Python 2.7 will be deprecated on 2020.
v0.1.2
- Added cancellation for each function
- LIST now use MLSD instead of NLST
- Added HELP menu to see function listing
- Note: There will be several garbage files for sandboxing!
This will list all the files on the FTP server.
>> LIST
List of directory:
...This will download a file from the FTP server to the client.
>> DOWNLOAD
Enter file name: abc.txt
Download abc.txt success.
...This will upload a file from the client to the FTP server.
>> UPLOAD
Enter file name: abc.txt
Upload abc.txt success.
...This will create a directory on the current working directory.
>> CREATEDIR
Enter directory name: rareguy
Create rareguy directory successThis will change the current working directory.
>> CREATEDIR
Select directory: rareguy
Current working directory: /rareguyThis will delete a file on the FTP server.
>> DELETE
Select a file to delete: abc.txt
Delete abc.txt success.This will upload a .zip file but instead of being a .zip file on the server, it will immediately be extracted from the zip. It works by extracting the zip on the local client, upload the full directory to the server, and then delete the extracted files on the client.
>> UPTRACT
Select file to upload & extract: test.zip
Extract success.
Upload test.zip success.This will show where your current working directory.
>> PWD
Current working directory: /rareguyDownload Python: Python