mirror of
https://gitlab.com/harald.mueller/aktuelle.kurse.git
synced 2024-11-23 18:21:56 +01:00
muh
This commit is contained in:
parent
39cb3a720e
commit
df14d92746
1
m122/LB_Einzelaufgabe_Projekt/testdaten.txt
Normal file
1
m122/LB_Einzelaufgabe_Projekt/testdaten.txt
Normal file
@ -0,0 +1 @@
|
||||
Testdaten H. Müller vom 16.5.2022
|
11
m122/tools-technics/README.md
Normal file
11
m122/tools-technics/README.md
Normal 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!
|
||||
|
33
m122/tools-technics/ftp.py
Normal file
33
m122/tools-technics/ftp.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user