2020-06-07 20:05:26 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
2020-08-09 05:14:55 +02:00
|
|
|
import os.path
|
2020-06-07 20:05:26 +02:00
|
|
|
import zipfile
|
2020-08-09 05:14:55 +02:00
|
|
|
from shutil import copyfile
|
2020-06-07 20:05:26 +02:00
|
|
|
|
|
|
|
if len(sys.argv) < 3:
|
2020-08-09 05:14:55 +02:00
|
|
|
print('usage: mkzip <lstfile> <dstpath>')
|
2020-06-07 20:05:26 +02:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
lst = []
|
|
|
|
with open(sys.argv[1], 'r') as f:
|
|
|
|
for line in f:
|
|
|
|
line = line.strip()
|
|
|
|
if line == '' or line[0] == '#':
|
|
|
|
continue
|
|
|
|
tok = line.split()
|
|
|
|
lst.append((tok[0], tok[1]))
|
|
|
|
|
|
|
|
for (fname, aname) in lst:
|
2020-08-09 05:14:55 +02:00
|
|
|
path = os.path.join(sys.argv[2], aname)
|
|
|
|
if not os.path.exists(path):
|
|
|
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
|
|
copyfile(fname, path)
|
|
|
|
print("Copying: " + path)
|
|
|
|
else:
|
|
|
|
print("Skipping: " + path)
|