{"id":187,"date":"2024-09-30T10:42:51","date_gmt":"2024-09-30T09:42:51","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=187"},"modified":"2024-09-30T10:43:44","modified_gmt":"2024-09-30T09:43:44","slug":"mwnci-dirpath-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-dirpath-function\/","title":{"rendered":"Mwnci dirpath() Function"},"content":{"rendered":"<h2><span id=\"Syntax\" class=\"mw-headline\">Syntax<\/span><\/h2>\n<p>dirpath(<i><b>path<\/b><\/i>)<\/p>\n<h2><span id=\"Description\" class=\"mw-headline\">Description<\/span><\/h2>\n<p><i>dirpath()<\/i> returns all but the last element of path, typically the path&#8217;s directory. After dropping the final element, trailing slashes are removed. It the path is empty, a \u201c.\u201d is returned. If the path consists entirely of separators, a single separator is returned. The returned path does not end in a separator unless it is the root directory.<\/p>\n<h2><span id=\"Example\" class=\"mw-headline\">Example<\/span><\/h2>\n<pre>path=\"\/path\/to\/some\/file\"\r\nprintln(\"Full path to file is: \", path)\r\nprintln(\"Path up-to file is: \",dirpath(path))\r\n\r\n\r\nFull path to file is: \/path\/to\/some\/file\r\nPath up-to file is: \/path\/to\/some\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax dirpath(path) Description dirpath() returns all but the last element of path, typically the path&#8217;s directory. After dropping the final element, trailing slashes are removed. It the path is empty, a \u201c.\u201d is returned. If the path consists entirely of separators, a single separator is returned. The returned path does not end in a separator &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-dirpath-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci dirpath() 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-187","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/187","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=187"}],"version-history":[{"count":1,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/187\/revisions"}],"predecessor-version":[{"id":188,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/187\/revisions\/188"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}