전산실짬밥/ASP2013. 2. 20. 10:29
Sub checkCreateDir(path, dir)

 

    Dim fso

 

    Set fso = Server.CreateObject("Scripting.FileSystemObject")

 

    If Not fso.FolderExists(path & dir) then

        fso.CreateFolder(path & dir)
    End if

 

    Set fso = nothing

 

End sub

 

Call checkCreateDir("D:\WWW\Images\", "Temp")

 

우선 서버에서 로컬 경로를 알아야 한다.

모른다면 Server.Mappath("\") 명령어로 알 수 있다.

 

위 소스코드는

/images/temp/ 디렉토리(폴더)가 있는지 체크하는 것이고

있으면 그냥 내비두고, 만약 없다면 생성하라는 것이다.

 

어쨋든 위와같이 쓰면된다.

Posted by 정훈승