ASP 파일 과 디 렉 터 리 에 존재 하 는 함수 코드 를 검사 합 니 다.

다음은 두 개의 자체 작성 ASP 함수 입 니 다.첫 번 째 함수 CheckDir 는 지정 한 폴 더 가 존재 하 는 지,즉 디 렉 터 리 가 존재 하 는 지 판단 하 는 데 사 용 됩 니 다.두 번 째 함수 CheckFile 은 지정 한 파일 이 디 렉 터 리 에 있 는 지 확인 하 는 데 사 용 됩 니 다.
두 함 수 는 모두 ASP 의 FileSystemObject 대상,즉 FSO 를 기반 으로 함수 로 작성 하여 나중에 사용 하기에 편리 합 니 다.
ASP 디 렉 터 리 에 존재 하 는 함수 코드 를 검사 합 니 다.

Function CheckDir(Byval FolderPath)
dim fso
folderpath=Server.MapPath(".")&"\"&folderpath
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(FolderPath) then
'  
    CheckDir = True
Else
'   
    CheckDir = False
End if
Set fso = nothing
End Function
혹시

Function isExistFolder(Byval folderDir)
	on error resume next
	If objFso.FolderExists(server.MapPath(folderDir)) Then isExistFolder=True Else isExistFolder=False
	if err then err.clear:isExistFolder=False
End Function
ASP 파일 에 존재 하 는 함수 코드 검사

Function CheckFile(Byval FilePath) '          
  Dim fso
  Filepath=Server.MapPath(FilePath)
  Set fso = Server.CreateObject("Scripting.FileSystemObject")
  If fso.FileExists(FilePath) then
  '  
      CheckFile = True
  Else
  '   
      CheckFile = False
  End if
  Set fso = nothing
End Function
혹시

Function isExistFile(Byval fileDir)
	on error resume next
	If (objFso.FileExists(server.MapPath(fileDir))) Then isExistFile=True Else isExistFile=False
	if err then err.clear:isExistFile=False
End Function
다음은 다른 네티즌 의 보충

'================================================== 
'   : CheckFile 
'   :           
'   :FileName ------       :/swf/1.swf 
'   :False ---- True 
'================================================== 
  Public Function CheckFile(FileName) 
     On Error Resume Next 
     Dim FsoObj 
     Set FsoObj = Server.CreateObject("Scripting.FileSystemObject") 
     If Not FsoObj.FileExists(Server.MapPath(FileName)) Then 
       CheckFile = False 
       Exit Function 
     End If 
     CheckFile = True:Set FsoObj = Nothing 
  End Function
ASP 에서 파일 과 디 렉 터 리 에 존재 하 는 함수 코드 를 검사 하 는 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 asp 파일 에 내용 이 있 는 지 여 부 는 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 많은 지원 바 랍 니 다!

좋은 웹페이지 즐겨찾기