Copy file and maybe copy stats. fix #349
This commit is contained in:
@@ -48,6 +48,11 @@ class MetaDataBase(Plugin):
|
|||||||
log.debug('Creating %s file: %s', (file_type, name))
|
log.debug('Creating %s file: %s', (file_type, name))
|
||||||
if os.path.isfile(content):
|
if os.path.isfile(content):
|
||||||
shutil.copy2(content, name)
|
shutil.copy2(content, name)
|
||||||
|
shutil.copyfile(content, name)
|
||||||
|
|
||||||
|
# Try and copy stats seperately
|
||||||
|
try: shutil.copystat(content, name)
|
||||||
|
except: pass
|
||||||
else:
|
else:
|
||||||
self.createFile(name, content)
|
self.createFile(name, content)
|
||||||
group['renamed_files'].append(name)
|
group['renamed_files'].append(name)
|
||||||
|
|||||||
@@ -89,7 +89,12 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
|||||||
src_files = [options.config_file, db_path, db_path + '-shm', db_path + '-wal']
|
src_files = [options.config_file, db_path, db_path + '-shm', db_path + '-wal']
|
||||||
for src_file in src_files:
|
for src_file in src_files:
|
||||||
if os.path.isfile(src_file):
|
if os.path.isfile(src_file):
|
||||||
shutil.copy2(src_file, toUnicode(os.path.join(new_backup, os.path.basename(src_file))))
|
dst_file = toUnicode(os.path.join(new_backup, os.path.basename(src_file)))
|
||||||
|
shutil.copyfile(src_file, dst_file)
|
||||||
|
|
||||||
|
# Try and copy stats seperately
|
||||||
|
try: shutil.copystat(src_file, dst_file)
|
||||||
|
except: pass
|
||||||
|
|
||||||
# Remove older backups, keep backups 3 days or at least 3
|
# Remove older backups, keep backups 3 days or at least 3
|
||||||
backups = []
|
backups = []
|
||||||
|
|||||||
Reference in New Issue
Block a user