diff --git a/couchpotato/core/providers/metadata/base.py b/couchpotato/core/providers/metadata/base.py index d2393dd..8cd1a1c 100644 --- a/couchpotato/core/providers/metadata/base.py +++ b/couchpotato/core/providers/metadata/base.py @@ -48,6 +48,11 @@ class MetaDataBase(Plugin): log.debug('Creating %s file: %s', (file_type, name)) if os.path.isfile(content): shutil.copy2(content, name) + shutil.copyfile(content, name) + + # Try and copy stats seperately + try: shutil.copystat(content, name) + except: pass else: self.createFile(name, content) group['renamed_files'].append(name) diff --git a/couchpotato/runner.py b/couchpotato/runner.py index 2a655d5..715eab5 100644 --- a/couchpotato/runner.py +++ b/couchpotato/runner.py @@ -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'] for src_file in src_files: 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 backups = []