网络编程
位置:首页>> 网络编程>> Asp编程>> [精品]ASP中常用的22个FSO文件操作函数(6)

[精品]ASP中常用的22个FSO文件操作函数(6)

 来源:cnlei.org 发布时间:2007-08-18 15:12:00 

标签:FSO,函数,文件操作

16.FSO复制指定文件夹目录


Function CopyAFolder(SourceFolder,DestinationFolder)  
’//功能:源目录存在时,才能对目录进行复制,目的目录无影响  
’//形参:源目录,目的目录  
’//返回值:成功为1,失败为-1  
’//  
Dim MyFolder  
If ReportFolderStatus(SourceFolder) = 1 and ReportFolderStatus(DestinationFolder) = -1 Then  
Set MyFolder = fso.GetFolder(SourceFolder)  
fso.CopyFolder SourceFolder,DestinationFolder  
CopyAFolder = 1  
Else  
CopyAFolder = -1  
End if  
End Function 


17.移动指定文件夹目录 


Function MoveAFolder(SourcePath,DestinationPath)  
’//功能:源目录存在时目的目录不存在时才能对目录进行移动  
’//形参:源目录,目的目录  
’//返回值:成功为1,失败为-1  
’//  
If ReportFolderStatus(SourcePath)=1 And ReportFolderStatus(DestinationPath)=0 Then  
fso.MoveFolder SourcePath, DestinationPath  
MoveAFolder = 1  
Else  
MoveAFolder = -1  
End if  
End Function 


18.判断某目录是否存在 


’Response.Write ReportFolderStatus("G:\soft\delphi\my_pro\")  
Function ReportFolderStatus(fldr)  
’//功能:判断目录是否存在  
’//形参:目录  
’//返回值:成功为1,失败为-1  
’//  
Dim msg  
msg = -1  
If (fso.FolderExists(fldr)) Then  
msg = 1  
Else  
msg = -1  
End If  
ReportFolderStatus = msg  
End Function 

 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com