|
|
@@ -1,12 +1,18 @@
|
|
1
|
|
-#!/usr/bin/env python
|
|
|
1
|
+#!/usr/bin/env python2
|
|
2
|
2
|
from __future__ import print_function
|
|
3
|
3
|
|
|
|
4
|
+import re
|
|
|
5
|
+import sys
|
|
|
6
|
+
|
|
4
|
7
|
from os import listdir
|
|
5
|
8
|
from os.path import dirname, isfile, join, isdir
|
|
6
|
9
|
|
|
7
|
10
|
ROOT_DIR = join(dirname(__file__), '..')
|
|
8
|
11
|
FILES_FOLDER = join(ROOT_DIR, 'files')
|
|
9
|
12
|
|
|
|
13
|
+def natural_sort_key(value):
|
|
|
14
|
+ return [int(s) if s.isdigit() else s.lower() for s in re.split(r"(\d+)", value)]
|
|
|
15
|
+
|
|
10
|
16
|
|
|
11
|
17
|
def get_file_lists():
|
|
12
|
18
|
if not isdir(FILES_FOLDER):
|
|
|
@@ -41,13 +47,17 @@ def check_files(file_list):
|
|
41
|
47
|
errors += 1
|
|
42
|
48
|
|
|
43
|
49
|
if errors == 0:
|
|
|
50
|
+ return True
|
|
44
|
51
|
print(" -> All Files found.")
|
|
|
52
|
+ return False
|
|
45
|
53
|
|
|
46
|
54
|
|
|
47
|
55
|
def main():
|
|
48
|
|
- for f, file_list in get_file_lists().items():
|
|
49
|
|
- print(f)
|
|
50
|
|
- check_files(file_list)
|
|
|
56
|
+ file_lists = get_file_lists()
|
|
|
57
|
+ newest_folder = sorted(file_lists.keys(), key=natural_sort_key)[-1]
|
|
|
58
|
+ print(newest_folder)
|
|
|
59
|
+ if not check_files(file_lists[newest_folder]):
|
|
|
60
|
+ sys.exit(1)
|
|
51
|
61
|
|
|
52
|
62
|
|
|
53
|
63
|
if __name__ == '__main__':
|