forked from wunnox/python_grundlagen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInhalt-Check
More file actions
executable file
·58 lines (50 loc) · 1.58 KB
/
Copy pathInhalt-Check
File metadata and controls
executable file
·58 lines (50 loc) · 1.58 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/local/bin/python3
##############################################
#
# Name: Inhalt-Check
#
# Author: Peter Christen
#
# Version: 1.0
#
# Date: 10.01.2017 1.0
#
# Purpose: Prüft ob alle Files verteilt werden
#
##############################################
import os,configparser,argparse
####Parameter auswerten
parser = argparse.ArgumentParser(description='Liest die Inventardaten des aktuellen Servers aus')
parser.add_argument('-c', action='store_true', help="Daten in CSV-Format ausgeben")
parser.add_argument('-j', action='store_true', help="Daten in Json-Format ausgeben")
parser.add_argument('-J', action='store_true', help="Daten in ein Json-File schreiben")
parser.add_argument('-l', action='store_true', help="Daten in Klar-Text ausgeben(Default)")
args = parser.parse_args()
###Config-File einlesen
config = configparser.ConfigParser()
config.read('Inhalt.cfg')
###Config-Daten zuordnen
basistarget=config['BASIS']['target']
basisverteil=config['BASIS']['verteil']
advancedtarget=config['ADVANCED']['target']
advancedverteil=config['ADVANCED']['verteil']
###Variablen
###Funktion
def anal_files():
file_l=[]
vert_l=[]
dir = os.popen("ls").readlines()
for f in dir:
if "Inhalt-Beispiele" in f[:-1]:
d = open(f[:-1],"r")
allezeilen = d.readlines()
d.close()
for zeile in allezeilen:
vert_l.append(zeile[:-1])
else:
file_l.append(f[:-1])
for datei in file_l:
if datei not in vert_l and 'Inhalt' not in datei:
print ('Datei:', datei, 'ist in keinem Verteilfile')
###Analyse starten
anal_files()