PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# this does not work in sololearn, as it requires live user input
# this was my first somewhat organized big project ever
from ftplib import FTP
import sys
import time
import os
import getpass
os.system('mode con: cols=100 lines=20')
os.system('color f0')
def retrFile():
try:
file_to_retr = input(" File to retrieve: ")
cur_dir = ftp.pwd()
file_to_write = open(file_to_retr, "wb")
ftp.retrbinary('RETR ' + cur_dir + "/" + file_to_retr, file_to_write.write, 1024)
file_to_write.close()
print(" Successfully downloaded file {}.".format(file_to_retr))
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run