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
|
||||
|
||||
names = get_names_list(args.file_in, args.cell_range, args.column_groups)
|
||||
print(names)
|
||||
|
||||
from directory import create_directories
|
||||
|
||||
create_directories(args.out, names)
|
||||
|
||||
#print(args.column_groups)
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
keepcharacters = (' ', '/', '.', '_')
|
||||
|
||||
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):
|
||||
for path in paths:
|
||||
|
|
Loading…
Reference in New Issue