{"id":195,"date":"2024-09-30T11:02:36","date_gmt":"2024-09-30T10:02:36","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=195"},"modified":"2024-09-30T11:02:36","modified_gmt":"2024-09-30T10:02:36","slug":"mwnci-file-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-file-function\/","title":{"rendered":"Mwnci file() Function"},"content":{"rendered":"<h2><span id=\"Syntax\" class=\"mw-headline\">Syntax<\/span><\/h2>\n<p>file(<i><b>filename<\/b><\/i>, <i><b>[extra]<\/b><\/i>)<\/p>\n<h2><span id=\"Description\" class=\"mw-headline\">Description<\/span><\/h2>\n<p>The <i>file()<\/i> function returns the last modification time of the file <i>filename<\/i> in epoch seconds (seconds since midnight, January 1, 1970). If the file does not exist, the\u00a0<i>file()<\/i>\u00a0function returns the NULL string.<\/p>\n<p>The user does not need permission to read the file but does require search permission on each directory in the path name leading to\u00a0<i>filename<\/i>. If the user does not have such permission, the\u00a0<i>file()<\/i>\u00a0function fails and returns the NULL string.<\/p>\n<p>When the\u00a0<i>extra<\/i>\u00a0parameter is specified, the\u00a0file()\u00a0function returns a more detailed string of information.<\/p>\n<p>When the optional <i>extra<\/i> parameter used, the additional information is given:<\/p>\n<pre>modtime atime ctime mode size numlinks type fileuid filegid\r\n<\/pre>\n<ul>\n<li>modtime is the last modification date expressed in epoch seconds<\/li>\n<li>atime is the last access time expressed in epoch seconds<\/li>\n<li>ctime is the last change status express in epoch seconds<\/li>\n<li>mode is the permissions expressed as an octal integer<\/li>\n<li>size is the length of the file expressed as the number of characters<\/li>\n<li>numlinks is the number of links to the file<\/li>\n<li>type is a string indicating the file type:\n<ul>\n<li>FILE &#8211; ordinary data file<\/li>\n<li>DIR &#8211; directory<\/li>\n<li>CHR &#8211; character special file<\/li>\n<li>BLOCK &#8211; block special file<\/li>\n<li>FIFO &#8211; pipe<\/li>\n<li>LINK &#8211; symbolic link<\/li>\n<li>SOCKET &#8211; Unix domain socket<\/li>\n<li>UNKNOWN &#8211; unknown file type<\/li>\n<\/ul>\n<\/li>\n<li>fileuid is the user id of the file owner<\/li>\n<li>filegid is the group id associated with the file<\/li>\n<\/ul>\n<h2><span id=\"Example\" class=\"mw-headline\">Example<\/span><\/h2>\n<pre>filename=\"\/etc\/passwd\"\r\na=file(filename)\r\nif (a) {\r\n    println(\"Enhanced Information: \\n\",file(filename,1))\r\n} else {\r\n    println(\"File does not exist\")\r\n}\r\n\r\n\r\n1665739665 1671171901 1665739665 0644 2779 1 FILE 0 0\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax file(filename, [extra]) Description The file() function returns the last modification time of the file filename in epoch seconds (seconds since midnight, January 1, 1970). If the file does not exist, the\u00a0file()\u00a0function returns the NULL string. The user does not need permission to read the file but does require search permission on each directory in &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-file-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci file() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-195","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":1,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/195\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/195\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}