Created
December 18, 2017 13:40
-
-
Save yilas/1137a17fb769eb9caee8b4b913cbeb2d to your computer and use it in GitHub Desktop.
Remove SENHW_ from /tmp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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