raise Exception('Source path "%s" is not readable' % source_path)
# try to create backup path if needed
- if not os.path.exists(backup_path):
- os.makedirs(backup_path)
+ os.makedirs(backup_path, exist_ok=True)
if not os.access(backup_path, os.W_OK):
raise Exception('Backup path "%s" is not writeable' % backup_path)
raise Exception('Index path "%s" is not readable' % previous_index_path)
# try to create backup path if needed
- if not os.path.exists(backup_path):
- os.makedirs(backup_path)
+ os.makedirs(backup_path, exist_ok=True)
if not os.access(backup_path, os.W_OK):
raise Exception('Backup path "%s" is not writeable' % backup_path)
raise Exception('Index path "%s" is not readable' % index)
# try to create backup path if needed
- if not os.path.exists(target_path):
- os.makedirs(target_path)
+ os.makedirs(target_path, exist_ok=True)
# make backup_tar_path absolute so that iterate_tar_path works fine
if backup_tar_path and not os.path.isabs(backup_tar_path):
# to preserve parent directory mtime, we save it
parent_dir = os.path.dirname(upath) or os.getcwd()
- if not os.path.exists(parent_dir):
- os.makedirs(parent_dir)
+ os.makedirs(parent_dir, exist_ok=True)
parent_dir_mtime = int(os.stat(parent_dir).st_mtime)
# if path is found in the newest index as to be snapshotted, deal with it