From 1d7ff26f2637928b75d26c726621ee972f99885f Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 4 Jul 2019 11:34:19 +0200 Subject: [PATCH] Fix / beggining of final destination --- aggregator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aggregator.py b/aggregator.py index 4f0b4c3..27e6c43 100644 --- a/aggregator.py +++ b/aggregator.py @@ -96,8 +96,9 @@ def write_files_new_place(initial_directory, directory_api, filename, target_dir file_place_in = directory_api.replace(initial_directory, '') add_id = str(id).zfill(2) f_place_in_after = re.sub('/([0-9]+)', '/\\g<1>{}'.format(add_id), file_place_in) - - file_path_after = os.path.join(target_directory, f_place_in_after[1:], filename) + if f_place_in_after[0] == '/': + f_place_in_after = f_place_in_after[1:] + file_path_after = os.path.join(target_directory, f_place_in_after, filename) mkdirs(file_path_after) if isinstance(data, (list, tuple, dict)):