{"id":1135,"date":"2010-01-11T17:20:11","date_gmt":"2010-01-11T17:20:11","guid":{"rendered":"http:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2010\/01\/11\/%e7%a7%bb%e9%99%a4%e4%b8%83%e5%a4%a9%e5%89%8d%e6%aa%94%e6%a1%88\/"},"modified":"2010-01-11T17:20:11","modified_gmt":"2010-01-11T17:20:11","slug":"%e7%a7%bb%e9%99%a4%e4%b8%83%e5%a4%a9%e5%89%8d%e6%aa%94%e6%a1%88","status":"publish","type":"post","link":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2010\/01\/%e7%a7%bb%e9%99%a4%e4%b8%83%e5%a4%a9%e5%89%8d%e6%aa%94%e6%a1%88\/","title":{"rendered":"\u79fb\u9664\u4e03\u5929\u524d\u6a94\u6848"},"content":{"rendered":"<p>\u7121\u5fc3\u5e79\u6b63\u4e8b\uff0c\u53ef\u662f\u537b\u6709\u5fc3\u641e script\uff0c\u9019\u771f\u662f&#8230;<\/p>\n<pre>\n#!\/usr\/bin\/env python\n# Usage:\n#   remove_files_older_than.py .\/*.jpg\nimport sys\nimport glob\nimport stat\nimport os\nimport time\nif len(sys.argv)expireDays :\nprint diff\/(60.0*60*24)\nprint \"Remove %s, mtime=%s...\" % (filename, time.strftime(\n\"%Y\/%m\/%d %H:%M:%S\", modifiedTime ) )\nos.remove( filename )\ndeletedCount=deletedCount+1\nif deletedCount &gt; 0:\nprint \"Remove %d files\" % deletedCount\nelse:\nprint \"No files expired.\"\n<\/pre>\n<p>\u4ee5\u4e0b\u5247\u662f\u6458\u9304\u81ea\uff1a<a href=\"http:\/\/phorum.study-area.org\/index.php\/topic,59285.msg303106.html\">Windows Shell \u522a\u9664\u4e03\u5929\u524d\u8cc7\u6599<\/a><br \/>\nPowerShell\u7684\u7528\u6cd5<\/p>\n<pre>\nGet-ChildItem -Recurse -force C:\\files | Where-Object {!($_.Mode -match \"d\") -and ((Get-Date).Subtract($_.LastWriteTime).TotalDays -gt 7) } | Remove-Item -Force\n<\/pre>\n<p>Bash \u7684\u7528\u6cd5<\/p>\n<pre>\nfind -mtime +7 -exec rm -f {} \\;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7121\u5fc3\u5e79\u6b63\u4e8b\uff0c\u53ef\u662f\u537b\u6709\u5fc3\u641e script\uff0c\u9019\u771f\u662f&#8230; #!\/usr\/bin\/env python # Usage: # remove_files_older_than.py .\/*.jpg import sys import glob import stat import os import time if len(sys.argv)expireDays : print diff\/(60.0*60*24) print &#8220;Remove %s, mtime=%s&#8230;&#8221; % (filename, time.strftime( &#8220;%Y\/%m\/%d %H:%M:%S&#8221;, modifiedTime ) ) os.remove( filename ) deletedCount=deletedCount+1 if deletedCount &gt; 0: print &#8220;Remove %d files&#8221; % deletedCount else: print &#8220;No files expired.&#8221; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2010\/01\/%e7%a7%bb%e9%99%a4%e4%b8%83%e5%a4%a9%e5%89%8d%e6%aa%94%e6%a1%88\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;\u79fb\u9664\u4e03\u5929\u524d\u6a94\u6848&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[17],"tags":[],"class_list":["post-1135","post","type-post","status-publish","format-standard","hentry","category-python"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2MOxp-ij","_links":{"self":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/comments?post=1135"}],"version-history":[{"count":0,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/1135\/revisions"}],"wp:attachment":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/media?parent=1135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/categories?post=1135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/tags?post=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}