Last active
December 28, 2015 20:09
Revisions
-
chenzixin revised this gist
Nov 20, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Delete Expired File Programed by Bingal, which will delete the files in current directory created 30 days ago.: -
chenzixin revised this gist
Nov 20, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,6 @@ Programed by Bingal, which will delete the files in current directory created 30 #!/usr/bin/python # encoding: utf-8 def main(): import os,time for fn in os.listdir(os.curdir): -
chenzixin revised this gist
Nov 20, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ### Delete Expired File Programed by Bingal, which will delete the files in current directory created 30 days ago.: ```python #!/usr/bin/python -
chenzixin created this gist
Nov 20, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ ### Delete Expired File 王斌编写的脚本,清理30天之前文件: ```python #!/usr/bin/python # encoding: utf-8 def main(): import os,time for fn in os.listdir(os.curdir): fp = os.path.join(os.curdir,fn) if not os.path.isfile(fp): continue if fn.startswith('.') or fn == 'delete_expired_file.py': continue ctime = int((time.time()-os.stat(fp).st_ctime)*1.0/(60*60*24)) if ctime > 30: os.remove(fp) print fn,ctime if __name__=="__main__": main() ```