mirror of
https://github.com/tanrax/guetzli-recursively.git
synced 2024-11-09 22:45:41 +01:00
Fixbug always delete source
This commit is contained in:
parent
e0b4541ecd
commit
26ef41bfac
@ -29,12 +29,13 @@ for dirpath, dirnames, files in walk(top_dir):
|
||||
except:
|
||||
size_out = size_source
|
||||
size_acurate = 100 * size_out / size_source
|
||||
# Check if it is cost effective to replace it
|
||||
if size_acurate < 100:
|
||||
# Remove source
|
||||
try:
|
||||
remove(url)
|
||||
except:
|
||||
pass
|
||||
if size_acurate < 100:
|
||||
# Move temp to source
|
||||
rename(url_out, url)
|
||||
print('Save ' + str(100 - size_acurate) + '%')
|
||||
|
Loading…
Reference in New Issue
Block a user