User Tools

Site Tools


python:folder_cleaner

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
python:folder_cleaner [2016/02/03 06:50]
admin [Usage]
python:folder_cleaner [2016/02/03 07:15]
admin [Requirements]
Line 8: Line 8:
 The script should remove specific files from a designated folder, with consideration to creation time. The script should remove specific files from a designated folder, with consideration to creation time.
  
-In this specific example, it will remove .gz and .log files above a variable number of days (specified in command line).+In this specific example, it will remove ​//.gz// and //.log// files above a variable number of days (specified in command line)
 + 
 +A couple of options are available using constants within the script. These should be modified accordingly to your specific needs.
  
 //Note: This is a python 2.6 version due some client server constraints,​ but it can easily be upgraded to 3.X.// //Note: This is a python 2.6 version due some client server constraints,​ but it can easily be upgraded to 3.X.//
Line 19: Line 21:
 Script to clean up unrecognized folder of older files. Script to clean up unrecognized folder of older files.
 It can be used from CLI or as a cronjob. It can be used from CLI or as a cronjob.
- 
-Usage: 
-    ./​unrecognized_cleanup.py - runs with the default settings (log to file, keep no files) 
-    ./​unrecognized_cleanup.py -k 10 - keep the last 10 days of files 
-    ./​unrecognized_cleanup.py --keep 10 --stdlog - keep 10 days and log to console 
 """​ """​
 __author__ = "​Cristian Navalici"​ __author__ = "​Cristian Navalici"​
Line 47: Line 44:
 LOG_FOLDER = '/​tmp/​logfiles'​ LOG_FOLDER = '/​tmp/​logfiles'​
  
-# after how many file shall we log an intermediate message+# after how many files shall we log an intermediate message
 LOG_MILESTONE = 10000 LOG_MILESTONE = 10000
  
python/folder_cleaner.txt · Last modified: 2016/02/03 07:15 by admin