add bzip2 compress support for path type files
This commit is contained in:
@@ -5,6 +5,7 @@ from game_backuper.hashl import sha512
|
||||
from shutil import copy2
|
||||
from game_backuper.filetype import FileType
|
||||
from os import remove
|
||||
from game_backuper.compress import supported_exts
|
||||
|
||||
|
||||
File = namedtuple('File', ['id', 'file', 'size', 'program', 'hash', 'type'])
|
||||
@@ -74,3 +75,15 @@ def remove_dirs(loc: str):
|
||||
except Exception:
|
||||
remove_dirs(i)
|
||||
remove(loc)
|
||||
|
||||
|
||||
def remove_compress_files(loc: str, prog: str, name: str, ext: str = None):
|
||||
exts = supported_exts.copy()
|
||||
if ext is not None:
|
||||
exts.remove(ext)
|
||||
exts.append('')
|
||||
for i in exts:
|
||||
f = loc + i
|
||||
if exists(f) and isfile(f):
|
||||
remove(f)
|
||||
print(f'{prog}: Removed {f}({name})')
|
||||
|
||||
Reference in New Issue
Block a user