This commit is contained in:
Harald Mueller 2022-05-24 13:49:44 +02:00
parent 39cb3a720e
commit df14d92746
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1 @@
Testdaten H. Müller vom 16.5.2022

View File

@ -0,0 +1,11 @@
# m122
## Tools & Technics
### FTP
- [https://www.howtoforge.com/tutorial/how-to-use-ftp-on-the-linux-shell/](https://www.howtoforge.com/tutorial/how-to-use-ftp-on-the-linux-shell/)
- HOST: ftp.haraldmueller.ch
- USER: schoolerinvoices
- PASS: Berufsschule8005!

View File

@ -0,0 +1,33 @@
import ftplib
import glob
def file_filename(path):
for filename in glob.glob(path):
file = open(filename, 'rb')
return file, filename
def upload_files():
ftp = ftplib.FTP("url", "username", "password")
file_txt = file_filename("uploads\\zahlungssystem\\*.txt")
filename_txt = file_filename("uploads\\zahlungssystem\\*.txt")
file_xml = file_filename("uploads\\zahlungssystem\\*.xml")
filename_xml = file_filename("uploads\\zahlungssystem\\*.xml")
# zum Erstzen (leer machen) der Pfadangaben
filename_txt = filename_txt.replace("uploads\\zahlungssystem\\", "")
filename_xml = filename_xml.replace("uploads\\zahlungssystem\\", "")
ftp.cwd("in/" + "foldername")
ftp.storbinary("STOR " + filename_txt)
ftp.storbinary("STOR " + file_txt)
file_txt.close()
ftp.storbinary("STOR " + filename_xml)
ftp.storbinary("STOR " + file_xml)
file_xml.close()
ftp.quit()