Skip to content

Instantly share code, notes, and snippets.

@strangeman
Created July 15, 2016 05:28
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 strangeman/d0f54298f476a6b23fdc935f59f2fbf4 to your computer and use it in GitHub Desktop.
Save strangeman/d0f54298f476a6b23fdc935f59f2fbf4 to your computer and use it in GitHub Desktop.
Delete many files from nginx cache
from time import sleep
import os
path = '/var/cache/nginx/client_temp/'
for file_name in xrange(0, 9999999999):
file_path = '/var/cache/nginx/client_temp/'+str(file_name).zfill(10)
print 'trying to delete '+file_path
try:
os.remove(file_path)
print 'deleted '+file_path
sleep(0.05)
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment