ASP

파일 삭제시 존재여부 확인하고 삭제하기(FSO)

귀찮은 여니씨 2008. 12. 4. 10:08
dB에는 올라와있는데 실제 디렉토리에 파일이 존재하지 않으면 오류가 뜨겠지요.
디렉토리에 파일 존재여부를 체크하고 삭제하도록

Server.ScriptTimeout = 1000
Set FSO = CreateObject("Scripting.FileSystemObject")
SQL = "select * from 테이블 where seq='"&request("seq")&"'"
rs.Open SQL,DbCon,1

'이미지 파일 삭제구문
if rs("picture1") <> "" then
emlFileDirectory = server.MapPath("../main/ency_img")&"\"&rs("picture1")

If (fso.FileExists(emlFileDirectory)) Then
fso.DeleteFile(emlFileDirectory)
End If
end if



-출처 : 네이버 카페 스페이스 최고의 프로그래머 대니(danny032)님이 게시한 게시물
http://cafe.naver.com/gosok.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=106