Application.FolderExistsOnDtsServer(String, String) 方法

定义

返回一个布尔值,该值指示指定的文件夹是否已存在于文件系统上。

public:
 bool FolderExistsOnDtsServer(System::String ^ sFolderName, System::String ^ sServerName);
public bool FolderExistsOnDtsServer (string sFolderName, string sServerName);
member this.FolderExistsOnDtsServer : string * string -> bool
Public Function FolderExistsOnDtsServer (sFolderName As String, sServerName As String) As Boolean

参数

sFolderName
String

要查找的文件夹的名称。 例如,若要查看文件系统文件夹下是否存在文件夹名称“myFolder”,请使用转义字符串 @"\File System\myFolder"。

sServerName
String

要搜索该包的服务器的名称。

返回

如果服务器上存在指定的文件夹,则为 true;如果文件夹不存在,则为 false。

示例

下面的代码示例查询文件系统,以确定之前创建的文件夹(名为 myFolder)是否存在。

class PackageTest  
    {  
        static void Main(string[] args)  
        {  
            Application app = new Application();  
            Package p = app.LoadPackage(pkg, null);  

            String folderName = @"\File System\myFolder";  
            String serverName = "yourserver";  
            Boolean folderExists = app.FolderExistsOnDtsServer(folderName, serverName);  
            Console.WriteLine("Folder exists? " + folderExists);  
        }  
    }  
Class PackageTest  
        Sub Main(ByVal args() As String)  
            Dim app As Application =  New Application()   
            Dim p As Package =  app.LoadPackage(pkg,Nothing)   

            Dim folderName As String =  "\File System\myFolder"   
            Dim serverName As String =  "yourserver"   
            Dim folderExists As Boolean =  app.FolderExistsOnDtsServer(folderName,serverName)   
            Console.WriteLine("Folder exists? " + folderExists)  
        End Sub  
End Class  

示例输出:

Folder exists? True

适用于