filter filenames for validity
This commit is contained in:
parent
c9cfdaa845
commit
c17c19b1a6
|
@ -11,10 +11,8 @@ args = parser.parse_args()
|
||||||
from spreadsheet import get_names_list
|
from spreadsheet import get_names_list
|
||||||
|
|
||||||
names = get_names_list(args.file_in, args.cell_range, args.column_groups)
|
names = get_names_list(args.file_in, args.cell_range, args.column_groups)
|
||||||
print(names)
|
|
||||||
|
|
||||||
from directory import create_directories
|
from directory import create_directories
|
||||||
|
|
||||||
create_directories(args.out, names)
|
create_directories(args.out, names)
|
||||||
|
|
||||||
#print(args.column_groups)
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
keepcharacters = (' ', '/', '.', '_')
|
||||||
|
|
||||||
def create_directory(name):
|
def create_directory(name):
|
||||||
Path(name).mkdir(parents=True, exist_ok=True)
|
filename = "".join([c for c in name if c.isalnum() or c in keepcharacters]).rstrip()
|
||||||
|
Path(filename).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
def create_directories(outdir, paths):
|
def create_directories(outdir, paths):
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
|
Loading…
Reference in New Issue