FTP 에서 디렉토리 및 파일 삭제가 안될때 2
작성일 19-11-27 08:55
페이지 정보
작성자서방님 조회 72회 댓글 0건본문
<?php error_reporting(E_ALL); ini_set("display_errors", 1); function rrmdir($dir) { if (is_dir($dir)) { echo "<br>[".$dir."] 디렉토리 확인중..."; echo "<br>주석을 해제하고 다시 실행하세요!"; exit; $objects = scandir($dir); // 디렉토리 스캔 foreach($objects as $object) { // 반복 if ($object != "." && $object != "..") { // 현재경로, 상위경로가 아니라면 if(filetype($dir."/".$object) == "dir") { // 파일타입 체크 후 디렉토리라면 echo "<br>".$dir."/".$object." 디렉토리 삭제"; rrmdir($dir."/".$object); // 디렉토리 삭제 } else { // 파일이라면 echo "<br>".$dir."/".$object." 파일 삭제"; unlink($dir."/".$object); } } } reset($objects); rmdir($dir); echo "<br>작업이 완료되었습니다."; } else { echo "<br>잘못된 디렉토리입니다."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>강제삭제</title> <meta http-equiv="Content-Type" content="text/html; chaRset=euc-kr"> <meta name="robots" content="noindex"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <style type="text/css"> html, body {background:#fff;} li {font-family:dotum, sans-serif; font-size:12px;} #container1 {width:1000px; margin:20px;} .adm_title {font-weight:bold; font-size:13px;} .adm {padding:5px; margin-bottom:5px; text-align:center; color:blue; font-weight:bold;} </style> </head> <body> <? /******************************************************************************** * 특정 디렉토리 강제 삭제 (오태정, 2019-10-04 15:11) ********************************************************************************/ rrmdir("./files"); // 상대경로 디렉토리명 설정 (ex. "./files") ?> </body> </html>
첨부파일
- delete.php (1.8K) 0회 다운로드 | DATE : 2019-11-27 08:55:51
댓글목록
등록된 댓글이 없습니다.