{"id":4279,"date":"2022-05-21T18:56:06","date_gmt":"2022-05-21T17:56:06","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=4279"},"modified":"2026-03-09T12:39:08","modified_gmt":"2026-03-09T12:39:08","slug":"working-with-files","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/files\/working-with-files","title":{"rendered":"Working with files"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Delete File<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/\/Delete the file\n  unlink($my_filename);<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Copy File<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  copy(\"MySourceFile.txt\",\"MyDestFile.txt\");     \/\/If the file already exists it will be overwritten.<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Move File \/ Rename File<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  rename(\"\/current\/MySourceFile.txt\",\"\/new\/MyDestFile.txt\");<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><\/h4>\n\n\n\n<h4 class=\"wp-block-heading\">Get file size<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  $Bytes = filesize($Path);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Delete File Copy File Move File \/ Rename File Get file size<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[],"class_list":["post-4279","post","type-post","status-publish","format-standard","hentry","category-files"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=4279"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4279\/revisions"}],"predecessor-version":[{"id":5321,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4279\/revisions\/5321"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=4279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=4279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=4279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}