{"id":12187,"date":"2022-05-11T04:22:23","date_gmt":"2022-05-11T08:22:23","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=12187"},"modified":"2022-05-11T04:22:25","modified_gmt":"2022-05-11T08:22:25","slug":"php-check-if-folder-exists","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/php-check-if-folder-exists\/","title":{"rendered":"Check if Folder Exists Using PHP"},"content":{"rendered":"\n
Use this code snippet to check if folder exists using PHP.<\/p>\n\n\n\n
$directory = "\/path\/to\/folder\/";\n\nif ( !file_exists( $directory ) ) {\n\n \/\/ create the directory\n mkdir($directory, 0755, true);\n\n \/\/ do something with the directory \n\n}\u00a0else\u00a0{\n\n \/\/ directory exists so do something with the it\n\n}<\/code><\/pre>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,25,27,15,16],"tags":[433,452,471,544,591,638],"yoast_head":"\nPHP Check if Folder Exists Example<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n