Fixbug always delete source

This commit is contained in:
Andros Fenollosa 2017-03-20 09:10:17 +01:00 committed by GitHub
parent e0b4541ecd
commit 26ef41bfac

View File

@ -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) + '%')