mirror of
https://github.com/tanrax/guetzli-recursively.git
synced 2024-12-22 20:25:35 +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:
|
except:
|
||||||
size_out = size_source
|
size_out = size_source
|
||||||
size_acurate = 100 * size_out / size_source
|
size_acurate = 100 * size_out / size_source
|
||||||
# Remove source
|
# Check if it is cost effective to replace it
|
||||||
try:
|
|
||||||
remove(url)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
if size_acurate < 100:
|
if size_acurate < 100:
|
||||||
|
# Remove source
|
||||||
|
try:
|
||||||
|
remove(url)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
# Move temp to source
|
# Move temp to source
|
||||||
rename(url_out, url)
|
rename(url_out, url)
|
||||||
print('Save ' + str(100 - size_acurate) + '%')
|
print('Save ' + str(100 - size_acurate) + '%')
|
||||||
|
Loading…
Reference in New Issue
Block a user