<%
Class UsCMS_FsoCls    
    Private Fso
    Public FsoObj
       

    Private Sub Class_Initialize    
        Set Fso=CreateObject("Scripting.FileSystemObject")    
        Set FsoObj=Fso    
    End Sub    
    
    Private Sub Class_Terminate    
        Set Fso=Nothing    
        Set FsoObj=Nothing    
    End Sub    


    Function GetFileText(ByVal FileDir)    
        If IsFileExists(Server.MapPath(FileDir)) Then    
            Dim F    
            Set F=Fso.OpenTextFile(Server.MapPath(FileDir))    
            GetFileText=F.ReadAll    
            Set F=Nothing    
        Else    
            GetFileText=False    
        End If    
    End Function    
       
   
    Function CreateFile(ByVal FileDir,ByVal FileContent)    
        'If IsFileExists(FileDir) Then    
        '   CreateFile=False    
        '   Exit Function    
        'Else    
            Dim F    
            Set F=Fso.CreateTextFile(Server.MapPath(FileDir))    
            F.Write FileContent    
            CreateFile=True    
            F.Close    
        'End If    
    End Function  
        
  
       
    Function CopyFile(ByVal FileName1,ByVal FileName2)   
        If IsFileExists(FileName1) Then    
            Fso.CopyFile FileName1,FileName2,true   
            CopyFile=True    
        Else    
            CopyFile=False    
        End If    
    End Function  

	Function DeleteFolder(FolderDir)
		If IsFolderExits(FolderDir) then 
   			FSO.DeleteFolder Server.MapPath(FolderDir),true
	end if

	End Function 
	
	Function IsFolderExits(FolderDir)
		If Fso.FolderExists(Server.MapPath(FolderDir)) Then
		   IsFolderExits=True
		Else
	       IsFolderExits=False
		End IF 
	End Function
       
    Function DelFile(ByVal FileDir)    
        If IsFileExists(FileDir) Then    
		
            Fso.DeleteFile(Server.MapPath(FileDir))    
            DelFile=True    
        Else    
            DelFile=False    
        End If    
    End Function 
	
	Function IsFileExists(ByVal FileDir)    
        If Fso.FileExists(Server.MapPath(FileDir)) Then    
            IsFileExists=True    
        Else    
            IsFileExists=False    
        End If    
    End Function  
	
End Class  
%> 

