Skip to content

Instantly share code, notes, and snippets.

@shinshiner
Created August 31, 2018 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinshiner/e1bcd988c86f512dd52fab3bd6cecc9c to your computer and use it in GitHub Desktop.
Save shinshiner/e1bcd988c86f512dd52fab3bd6cecc9c to your computer and use it in GitHub Desktop.
A small script to clean your disk, preventing data recovery
import os
import time
total = 80 # the number of copied files, decided by your free disk space
times = 2 # clean times, the more, the better
big_file = 'xxx' # a big file, maybe a .zip file or others ...
for j in range(times):
for i in range(total):
tgt_path = '%03d' % i
print(tgt_path)
if not os.path.exists(tgt_path):
os.makedirs(tgt_path)
os.system('cp %s ~/%03d/' % (big_file, i))
time.sleep(60)
for i in range(total):
os.system('rm -r ~/%03d' % i)
print('finish clean disk\n')
time.sleep(120)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment