Skip to content

Instantly share code, notes, and snippets.

@yilas
Created December 18, 2017 13:40
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 yilas/1137a17fb769eb9caee8b4b913cbeb2d to your computer and use it in GitHub Desktop.
Save yilas/1137a17fb769eb9caee8b4b913cbeb2d to your computer and use it in GitHub Desktop.
Remove SENHW_ from /tmp
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# vim: :set ts=8 et sw=4 sts=4
import glob, sys
def CleanTmpDir():
folder = '/tmp'
import os
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path) and the_file.startswith('SENHW_'):
os.unlink(file_path)
except Exception, e:
print e
listTmp = glob.glob('/tmp/*')
lenList = len(listTmp)
print 'Number of files on /tmp : %s' % str(lenList)
CleanTmpDir()
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment