Dim fso                   '파일객체
 Dim rep_dirPath               '/rep폴더 경로
   Dim deleted_dirPath          '/rep/deleted/폴더 경로
   
   Dim del_filePath          '이동전 파일전체경로
   Dim del_file              '이동시킬 파일객체
   Dim del_fileName          '이동시킬 파일명 
      
   rep_dirPath  = Server.MapPath("/Rep/") 
   deleted_dirPath = rep_dirPath & "\deleted\"
   
   del_filePath = replace(pgmid,"/Rep/","")
   del_filePath = replace(del_filePath,"/rep/","")
   del_filePath = replace(del_filePath,"/","\")
   del_filePath = rep_dirPath & "\" & del_filePath
   
   Set fso = CreateObject("Scripting.FileSystemObject")

    If (fso.FileExists(del_filePath)) Then
     set del_file = fso.GetFile(del_filepath)
    del_fileName = del_file.name
    
    '이미 /rep/delete/ 경로에 같은 이름의 파일이 있으면 그파일 삭제 
    if(fso.FileExists(deleted_dirPath & del_fileName)) then 
     Dim same_file                
      set same_file = fso.GetFile(deleted_dirPath & del_fileName)
      same_file.delete
    end if
   
    fso.MoveFile del_filePath, deleted_dirPath
    End if  
 
  Set fso = nothing  
 end if

'개발 > ASP' 카테고리의 다른 글

iis6/ii7 디버깅 오류표시방법  (0) 2013.08.02
ASP에서 DB값 NULL 체크 하는 방법  (0) 2012.06.19
ASP 내장객체 - Session  (0) 2008.10.24
블로그 이미지

쭈니후니

개발자로서 공부와 낚시를 좋아하는 한사람으로서의 추억을 담을 블로그입니다.

,