{"id":3607,"date":"2015-02-20T11:14:13","date_gmt":"2015-02-20T11:14:13","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=3607"},"modified":"2015-02-20T11:14:13","modified_gmt":"2015-02-20T11:14:13","slug":"format-time-of-file-modification-to-use-in-a-shell-script","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=3607","title":{"rendered":"Format Time of File Modification to use in a Shell Script"},"content":{"rendered":"<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ls -l --full-time make.sh\r\n-rw-------+ 1 AndreasB mkpasswd 5772 2015-02-12 11:35:54.323703100 +0100 make.sh\r\n\r\n$ perl -MPOSIX=strftime -le 'print strftime(&quot;%Y%m%d&quot;, localtime((stat shift)&#x5B;9]))' make.sh\r\n20150212\r\n\r\n$ stat make.sh\r\n  File: 'make.sh'\r\n  Size: 5772            Blocks: 8          IO Block: 65536  regular file\r\nDevice: 7a51ec0fh\/2052189199d   Inode: 12384898975415113  Links: 1\r\nAccess: (0600\/-rw-------)  Uid: (  400\/AndreasB)   Gid: (  401\/mkpasswd)\r\nAccess: 2015-02-12 11:35:54.323703100 +0100\r\nModify: 2015-02-12 11:35:54.323703100 +0100\r\nChange: 2015-02-13 14:48:31.352376000 +0100\r\n Birth: 2014-11-26 17:16:45.173977800 +0100\r\n\r\n$ stat -c %y make.sh\r\n2015-02-12 11:35:54.323703100 +0100\r\n\r\n$ stat -c %x make.sh\r\n2015-02-12 11:35:54.323703100 +0100\r\n<\/pre>\n<p><a href=\"http:\/\/www.unix.com\/unix-for-advanced-and-expert-users\/27079-file-date-format.html\">file date format<\/a><br \/>\n<a href=\"http:\/\/www.cyberciti.biz\/faq\/linux-unix-formatting-dates-for-display\/\">HowTo Format Date For Display or Use In a Shell Script<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$ ls -l &#8211;full-time make.sh -rw&#8212;&#8212;-+ 1 AndreasB mkpasswd 5772 2015-02-12 11:35:54.323703100 +0100 make.sh $ perl -MPOSIX=strftime -le &#8216;print strftime(&quot;%Y%m%d&quot;, localtime((stat shift)&#x5B;9]))&#8217; make.sh 20150212 $ stat make.sh File: &#8216;make.sh&#8217; Size: 5772 Blocks: 8 IO Block: 65536 regular file Device: 7a51ec0fh\/2052189199d Inode: 12384898975415113 Links: 1 Access: (0600\/-rw&#8212;&#8212;-) Uid: ( 400\/AndreasB) Gid: ( 401\/mkpasswd) Access: 2015-02-12 11:35:54.323703100 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3607","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3607"}],"version-history":[{"count":1,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3607\/revisions"}],"predecessor-version":[{"id":3608,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3607\/revisions\/3608"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}