<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      FileSystem對象常用的文件設置函數

      [摘要]FileSystem對象常用的文件操作函數1、root函數格式 root()功能描述 返回一個路徑串變量應用代碼 'sample string = c:\intels\jingcaichun...

      FileSystem對象常用的文件操作函數1、root
      函數格式 root()
      功能描述 返回一個路徑串變量
      應用代碼 'sample string = c:\intels\jingcaichunfeng\' 
      Public Function root() 
       root = Request.ServerVariables("Appl_Physical_Path") 
      End Function 2、url
      函數格式 url()
      功能描述 返回一個URL串變量
      應用代碼 'sample string = http://www.intels.net/filesys.asp&#39; 
      Public Function url() 
       url ="http://";&Request.ServerVariables("Server_Name") 
      &Request.ServerVariables("Script_Name") 
      End Function 3、mkdir
      函數格式 mkdir( DIrName )
      功能描述 創建一個目錄并返回信息
      應用代碼 Public Function mkdir( xVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FolderExists( xVar ) Then 
        msg ="抱歉,該目錄已存在! " 
       Else 
        Sys.CreateFolder( xVar ) 
        msg ="恭喜,目錄創建成功! " 
       End If 
       Set Sys = Nothing 
       mkdir = msg 
      End Function4、rmdir
      函數格式 rmdir( DirName )
      功能描述 刪除一個目錄并返回信息
      應用代碼 Public Function rmdir( xVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FolderExists( xVar ) Then 
        Sys.DeleteFolder( xVar ) 
        msg ="恭喜,目錄刪除成功!" 
       Else 
        msg ="抱歉,該目錄還未被創建! " 
       End If 
       Set Sys = Nothing 
       rmdir = msg 
      End Function5、isdir
      函數格式 isdir( DirName )
      功能描述 檢查一個目錄是否存在并返回信息
      應用代碼 Public Function isdir( xVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FolderExists( xVar ) Then 
        msg = True 
       Else 
        msg = False 
       End If 
       Set Sys = Nothing 
       isdir = msg 
      End Function6、cpdir
      函數格式 cpdir( DirName, Destination, OverWrite )
      功能描述 復制文件夾并返回信息
      應用代碼 Public Function cpdir( xVar, yVar, zVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FolderExists( xVar ) Then 
        Sys.CopyFolder xVar, root&yVar, zVar 
        msg ="恭喜,目錄復制成功!" 
       Else 
        msg ="抱歉,沒有找到您想要的目錄!" 
       End If 
       Set Sys = Nothing 
       cpdir = msg 
      End Function7、mvdir
      函數格式 mvdir( DirName, Destination )
      功能描述 移動一個文件夾并返回信息
      應用代碼 Public Function mvdir( xVar, yVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FolderExists( xVar ) Then 
        Sys.MoveFolder xVar, root&yVar 
        msg ="恭喜,目錄夾已移動!" 
       Else 
        msg ="抱歉,沒有找到您想要的目錄!" 
       End If 
       Set Sys = Nothing 
       mvdir = msg 
      End Function8、isfile
      函數格式 isfile( FileName )
      功能描述 檢查文件是否存在并返回信息
      應用代碼 Public Function isfile( xVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FileExists( xVar ) Then 
        msg = True 
       Else 
        msg = False 
       End If 
       Set Sys = Nothing 
       isfile = msg 
      End Function9、wfile
      函數格式 wfile( FileName, OverWrite, String )
      功能描述 寫入串到一個文件并返回信息
      應用代碼 Public Function wfile( xVar, yVar, zVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If yVar Then 
        Set Txt = Sys.OpenTextFile( xVar, 2 ) 
        Txt.Write( zVar ) 
        Txt.Close 
        msg ="恭喜,文件創建成功并保存!" 
       Else 
        If Sys.FileExists( xVar ) Then 
         msg ="抱歉,文件已經存在!" 
        End If 
       Set Sys = Nothing 
       wfile = msg 
      End Function10、rfile
      函數格式 rfile( FileName )
      功能描述 讀取一個文件并返回信息
      應用代碼 Public Function rfile( xVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FileExists( xVar ) Then 
        Set Txt = Sys.OpenTextFile( xVar, 1 ) 
        msg = Txt.ReadAll 
        Txt.Close 
       Else 
        msg ="抱歉,文件不存在!" 
       End If 
       Set Sys = Nothing 
       rfile = msg 
      End Function11、afile
      函數格式 afile( FileName, String )
      功能描述 添加串到一個文件并返回信息
      應用代碼 Public Function afile( xVar, zVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FileExists( xVar ) Then 
        Set Txt = Sys.OpenTextFile( xVar, 8 ) 
        Txt.Write( zVar ) 
        Txt.Close 
         msg ="恭喜,文件添加成功并保存!" 
       Else 
        msg ="抱歉,文件不存在!" 
       End If 
       Set Sys = Nothing 
       afile = msg 
      End Function12、cpfile
      函數格式 cpfile( FileName, Destination, OverWrite )
      功能描述 復制一個文件并返回信息
      應用代碼 Public Function cpfile( xVar, yVar, zVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FileExists( xVar ) Then 
        Sys.CopyFile xVar, root&yVar, zVar 
        msg ="恭喜,文件復制成功!" 
       Else 
        msg ="抱歉,文件復制失敗!" 
       End If 
       Set Sys = Nothing 
       cpfile = msg 
      End Function13、mvfile
      函數格式 mvfile( FileName, Destination )
      功能描述 移動一個文件并返回信息
      應用代碼 Public Function mvfile( xVar, yVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FileExists( xVar ) Then 
        Sys.MoveFile xVar, root&yVar 
          msg ="恭喜,文件移動成功!" 
       Else 
        msg ="抱歉,文件移動失敗!" 
       End If 
       Set Sys = Nothing 
       mvfile = msg 
      End Function14、rmfile 
      函數格式 rmfile( FileName )
      功能描述 刪除一個文件并返回信息
      應用代碼 Public Function rmfile( xVar ) 
       Set Sys = Server.CreateObject("Scripting.FileSystemObject") 
       If Sys.FileExists( xVar ) Then 
        Sys.DeleteFile( xVar ) 
        msg ="恭喜,文件刪除成功!" 
       Else 
        msg ="抱歉,文件刪除失敗!" 
       End If 
       Set Sys = Nothing 
       rmfile = msg 
      End Function


      日韩精品一区二区三区高清