Aracılığıyla paylaş


Directory.GetFileSystemEntries Yöntem

Tanım

Belirtilen ölçütleri karşılayan tüm dosyaların ve alt dizinlerin adlarını döndürür.

Aşırı Yüklemeler

GetFileSystemEntries(String)

Belirtilen bir yoldaki tüm dosyaların ve alt dizinlerin adlarını döndürür.

GetFileSystemEntries(String, String)

Belirtilen yoldaki bir arama deseni ile eşleşen dosya adları ve dizin adları dizisi döndürür.

GetFileSystemEntries(String, String, EnumerationOptions)

Belirtilen bir yoldaki arama deseni ve numaralandırma seçenekleriyle eşleşen bir dosya adları ve dizin adları dizisi döndürür.

GetFileSystemEntries(String, String, SearchOption)

Belirtilen yoldaki bir arama deseni ile eşleşen tüm dosya adlarından ve dizin adlarından oluşan bir dizi döndürür ve isteğe bağlı olarak alt dizinleri arar.

GetFileSystemEntries(String)

Kaynak:
Directory.cs
Kaynak:
Directory.cs
Kaynak:
Directory.cs

Belirtilen bir yoldaki tüm dosyaların ve alt dizinlerin adlarını döndürür.

public:
 static cli::array <System::String ^> ^ GetFileSystemEntries(System::String ^ path);
public static string[] GetFileSystemEntries (string path);
static member GetFileSystemEntries : string -> string[]
Public Shared Function GetFileSystemEntries (path As String) As String()

Parametreler

path
String

Aranacak dizinin göreli veya mutlak yolu. Bu dize, büyük küçük harf duyarlı değildir.

Döndürülenler

String[]

Belirtilen dizindeki dosya ve alt dizin adlarının dizisi veya hiçbir dosya ya da alt dizin bulunamazsa boş bir dizi.

Özel durumlar

Çağıranın gerekli izni yok.

2.1'den eski .NET Framework ve .NET Core sürümleri: path sıfır uzunlukta bir dizedir, yalnızca boşluk içerir veya bir veya daha fazla geçersiz karakter içerir. ile GetInvalidPathChars()geçersiz karakterleri sorgulayabilirsiniz.

path, null değeridir.

Belirtilen yol, dosya adı veya her ikisi birden sistem tarafından tanımlanan en fazla uzunluğu aşıyor.

path bir dosya adıdır.

Belirtilen yol geçersiz (örneğin, eşlenmemiş bir sürücüde).

Örnekler

Aşağıdaki örnek, bir dize dizisini kullanıcı tarafından belirtilen bir konumdaki tüm dosya ve alt dizinlerin adlarıyla doldurmak için yöntemini kullanır GetFileSystemEntries ve dizideki her dizeyi konsola yazdırır. Örnek, bu yöntemde ortak olan tüm hataları yakalayacak şekilde yapılandırılmıştır.

using namespace System;
class Class1
{
public:
   void PrintFileSystemEntries( String^ path )
   {
      try
      {
         
         // Obtain the file system entries in the directory path.
         array<String^>^directoryEntries = System::IO::Directory::GetFileSystemEntries( path );
         for ( int i = 0; i < directoryEntries->Length; i++ )
         {
            System::Console::WriteLine( directoryEntries[ i ] );

         }
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, \HelloServer'                  or contains invalid characters." );
      }
      catch ( System::IO::DirectoryNotFoundException^ ) 
      {
         System::Console::WriteLine(  "The path encapsulated in the \HelloServer'                  Directory object does not exist." );
      }

   }

   void PrintFileSystemEntries( String^ path, String^ pattern )
   {
      try
      {
         
         // Obtain the file system entries in the directory
         // path that match the pattern.
         array<String^>^directoryEntries = System::IO::Directory::GetFileSystemEntries( path, pattern );
         for ( int i = 0; i < directoryEntries->Length; i++ )
         {
            System::Console::WriteLine( directoryEntries[ i ] );

         }
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, \HelloServer'                  or contains invalid characters." );
      }
      catch ( System::IO::DirectoryNotFoundException^ ) 
      {
         System::Console::WriteLine(  "The path encapsulated in the \HelloServer'                  Directory object does not exist." );
      }

   }


   // Print out all logical drives on the system.
   void GetLogicalDrives()
   {
      try
      {
         array<String^>^drives = System::IO::Directory::GetLogicalDrives();
         for ( int i = 0; i < drives->Length; i++ )
         {
            System::Console::WriteLine( drives[ i ] );

         }
      }
      catch ( System::IO::IOException^ ) 
      {
         System::Console::WriteLine(  "An I/O error occurs." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }

   }

   void GetParent( String^ path )
   {
      try
      {
         System::IO::DirectoryInfo^ directoryInfo = System::IO::Directory::GetParent( path );
         System::Console::WriteLine( directoryInfo->FullName );
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, or \HelloServer'                  contains invalid characters." );
      }

   }

   void Move( String^ sourcePath, String^ destinationPath )
   {
      try
      {
         System::IO::Directory::Move( sourcePath, destinationPath );
         System::Console::WriteLine(  "The directory move is complete." );
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, \HelloServer'                  or contains invalid characters." );
      }
      catch ( System::IO::IOException^ ) 
      {
         System::Console::WriteLine(  "An attempt was made to move a \HelloServer'                  directory to a different \HelloServer'                  volume, or destDirName \HelloServer'                  already exists." );
      }

   }

};

int main()
{
   Class1 * snippets = new Class1;
   String^ path = System::IO::Directory::GetCurrentDirectory();
   String^ filter =  "*.exe";
   snippets->PrintFileSystemEntries( path );
   snippets->PrintFileSystemEntries( path, filter );
   snippets->GetLogicalDrives();
   snippets->GetParent( path );
   snippets->Move(  "C:\\proof",  "C:\\Temp" );
   return 0;
}
using System;

namespace GetFileSystemEntries
{
    class Class1
    {
        static void Main(string[] args)
        {
            Class1 snippets = new Class1();

            string path = System.IO.Directory.GetCurrentDirectory();
            string filter = "*.exe";

            snippets.PrintFileSystemEntries(path);
            snippets.PrintFileSystemEntries(path, filter);		
            snippets.GetLogicalDrives();
            snippets.GetParent(path);
            snippets.Move("C:\\proof", "C:\\Temp");
        }

        void PrintFileSystemEntries(string path)
        {
            
            try
            {
                // Obtain the file system entries in the directory path.
                string[] directoryEntries =
                    System.IO.Directory.GetFileSystemEntries(path);

                foreach (string str in directoryEntries)
                {
                    System.Console.WriteLine(str);
                }
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, " +
                    "or contains invalid characters.");
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                System.Console.WriteLine("The path encapsulated in the " +
                    "Directory object does not exist.");
            }
        }
        void PrintFileSystemEntries(string path, string pattern)
        {
            try
            {
                // Obtain the file system entries in the directory
                // path that match the pattern.
                string[] directoryEntries =
                    System.IO.Directory.GetFileSystemEntries(path, pattern);

                foreach (string str in directoryEntries)
                {
                    System.Console.WriteLine(str);
                }
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, " +
                    "or contains invalid characters.");
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                System.Console.WriteLine("The path encapsulated in the " +
                    "Directory object does not exist.");
            }
        }

        // Print out all logical drives on the system.
        void GetLogicalDrives()
        {
            try
            {
                string[] drives = System.IO.Directory.GetLogicalDrives();

                foreach (string str in drives)
                {
                    System.Console.WriteLine(str);
                }
            }
            catch (System.IO.IOException)
            {
                System.Console.WriteLine("An I/O error occurs.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
        }
        void GetParent(string path)
        {
            try
            {
                System.IO.DirectoryInfo directoryInfo =
                    System.IO.Directory.GetParent(path);

                System.Console.WriteLine(directoryInfo.FullName);
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, or " +
                    "contains invalid characters.");
            }
        }
        void Move(string sourcePath, string destinationPath)
        {
            try
            {
                System.IO.Directory.Move(sourcePath, destinationPath);
                System.Console.WriteLine("The directory move is complete.");
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, " +
                    "or contains invalid characters.");	
            }
            catch (System.IO.IOException)
            {
                System.Console.WriteLine("An attempt was made to move a " +
                    "directory to a different " +
                    "volume, or destDirName " +
                    "already exists.");
            }
        }
    }
}
open System
open System.IO
open System.Security

let printFileSystemEntries path =
    try
        // Obtain the file system entries in the directory path.
        let directoryEntries = Directory.GetFileSystemEntries path

        for str in directoryEntries do
            printfn $"{str}"
    with 
    | :? ArgumentNullException ->
        printfn "Path is a null reference."
    | :? SecurityException ->
        printfn $"The caller does not have the required permission."
    | :? ArgumentException ->
        printfn $"Path is an empty string, contains only white spaces, or contains invalid characters."
    | :? DirectoryNotFoundException ->
        printfn $"The path encapsulated in the Directory object does not exist."

let printFileSystemEntriesPattern path pattern =
    try
        // Obtain the file system entries in the directory
        // path that match the pattern.
        let directoryEntries = Directory.GetFileSystemEntries(path, pattern)

        for str in directoryEntries do
            printfn $"{str}"
    with
    | :? ArgumentNullException -> printfn "Path is a null reference."
    | :? SecurityException -> printfn "The caller does not have the required permission."
    | :? ArgumentException -> printfn "Path is an empty string, contains only white spaces, or contains invalid characters."
    | :? DirectoryNotFoundException -> printfn "The path encapsulated in the Directory object does not exist."

// Print out all logical drives on the system.
let getLogicalDrives () =
    try
        let drives = Directory.GetLogicalDrives()

        for str in drives do
            printfn $"{str}"
    with
    | :? IOException -> printfn "An I/O error occurs."
    | :? SecurityException -> printfn "The caller does not have the required permission."

let getParent path =
    try
        let directoryInfo = Directory.GetParent path
        printfn $"{directoryInfo.FullName}"

    with
    | :? ArgumentNullException -> printfn "Path is a null reference."
    | :? ArgumentException -> printfn "Path is an empty string, contains only white spaces, or contains invalid characters."

let move sourcePath destinationPath =
    try
        Directory.Move(sourcePath, destinationPath)
        printfn "The directory move is complete."

    with
    | :? ArgumentNullException -> printfn "Path is a null reference."
    | :? SecurityException -> printfn "The caller does not have the required permission."
    | :? ArgumentException -> printfn "Path is an empty string, contains only white spaces, or contains invalid characters."
    | :? IOException -> printfn "An attempt was made to move a directory to a different volume, or destDirName already exists."

let path = Directory.GetCurrentDirectory()
let filter = "*.exe"

printFileSystemEntries path
printFileSystemEntriesPattern path filter
getLogicalDrives ()
getParent path
move "C:\\proof" "C:\\Temp"
Option Explicit On 
Option Strict On

Namespace GetFileSystemEntries
    Class Class1
        Overloads Shared Sub Main(ByVal args() As String)
            Dim snippets As New Class1()
            Dim path As String = System.IO.Directory.GetCurrentDirectory()
            Dim filter As String = "*.exe"
            snippets.PrintFileSystemEntries(path)
            snippets.PrintFileSystemEntries(path, filter)
            snippets.GetLogicalDrives()
            snippets.GetParent(path)
            snippets.Move("C:\proof", "C:\Temp")
        End Sub

        Sub PrintFileSystemEntries(ByVal path As String)
            Try
                ' Obtain the file system entries in the directory path.
                Dim directoryEntries As String()
                directoryEntries = System.IO.Directory.GetFileSystemEntries(path)
                Dim str As String
                For Each str In directoryEntries
                    System.Console.WriteLine(str)
                Next str
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                        "required permission.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                        "contains only white spaces, " + _
                                        "or contains invalid characters.")
            Catch exp As System.IO.DirectoryNotFoundException
                System.Console.WriteLine("The path encapsulated in the " + _
                                        "Directory object does not exist.")
            End Try
        End Sub
        Sub PrintFileSystemEntries(ByVal path As String, _
                                   ByVal pattern As String)
            Try
                ' Obtain the file system entries in the directory
                ' path that match the pattern.
                Dim directoryEntries As String()
                directoryEntries = _
                   System.IO.Directory.GetFileSystemEntries(path, pattern)

                Dim str As String
                For Each str In directoryEntries
                    System.Console.WriteLine(str)
                Next str
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                        "required permission.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                        "contains only white spaces, " + _
                                        "or contains invalid characters.")
            Catch exp As System.IO.DirectoryNotFoundException
                System.Console.WriteLine("The path encapsulated in the " + _
                                        "Directory object does not exist.")
            End Try
        End Sub

        ' Print out all logical drives on the system.
        Sub GetLogicalDrives()
            Try
                Dim drives As String()
                drives = System.IO.Directory.GetLogicalDrives()

                Dim str As String
                For Each str In drives
                    System.Console.WriteLine(str)
                Next str
            Catch exp As System.IO.IOException
                System.Console.WriteLine("An I/O error occurs.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                           "required permission.")
            End Try
        End Sub
        Sub GetParent(ByVal path As String)
            Try
                Dim directoryInfo As System.IO.DirectoryInfo
                directoryInfo = System.IO.Directory.GetParent(path)
                System.Console.WriteLine(directoryInfo.FullName)
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                     "contains only white spaces, or " + _
                                     "contains invalid characters.")
            End Try
        End Sub
        Sub Move(ByVal sourcePath As String, ByVal destinationPath As String)
            Try
                System.IO.Directory.Move(sourcePath, destinationPath)
                System.Console.WriteLine("The directory move is complete.")
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                           "required permission.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                        "contains only white spaces, " + _
                                        "or contains invalid characters.")
            Catch exp As System.IO.IOException
                System.Console.WriteLine("An attempt was made to move a " + _
                                        "directory to a different " + _
                                        "volume, or destDirName " + _
                                        "already exists.")
            End Try
        End Sub
    End Class
End Namespace

Açıklamalar

Döndürülen dosya ve dizin adlarının sırası garanti değildir; Sort belirli bir sıralama düzeni gerekiyorsa yöntemini kullanın.

EnumerateFileSystemEntries ve GetFileSystemEntries yöntemleri aşağıdaki gibi farklılık gösterir: kullandığınızdaEnumerateFileSystemEntries, koleksiyonun tamamı döndürülmeden önce girdi koleksiyonunu listelemeye başlayabilirsiniz; kullandığınızdaGetFileSystemEntries, diziye erişebilmek için tüm girdi dizisinin döndürülmesini beklemeniz gerekir. Bu nedenle, birçok dosya ve dizinle EnumerateFileSystemEntries çalışırken daha verimli olabilir.

Bu yöntem, arama deseni olarak belirtilen yıldız işareti (*) ile aynıdır GetFileSystemEntries .

parametresinin path göreli veya mutlak yol bilgilerini belirtmesine izin verilir. Göreli yol bilgisi, geçerli çalışma dizinine göre yorumlanır. Geçerli çalışma dizinini edinmek için bkz GetCurrentDirectory. .

parametresinin path büyük/küçük harf duyarlılığı, kodun üzerinde çalıştığı dosya sistemine karşılık gelir. Örneğin, NTFS'de (varsayılan Windows dosya sistemi) büyük/küçük harfe duyarlı değildir ve Linux dosya sistemlerinde büyük/küçük harfe duyarlıdır.

Yaygın G/Ç görevlerinin listesi için bkz. Ortak G/Ç Görevleri.

Ayrıca bkz.

Şunlara uygulanır

GetFileSystemEntries(String, String)

Kaynak:
Directory.cs
Kaynak:
Directory.cs
Kaynak:
Directory.cs

Belirtilen yoldaki bir arama deseni ile eşleşen dosya adları ve dizin adları dizisi döndürür.

public:
 static cli::array <System::String ^> ^ GetFileSystemEntries(System::String ^ path, System::String ^ searchPattern);
public static string[] GetFileSystemEntries (string path, string searchPattern);
static member GetFileSystemEntries : string * string -> string[]
Public Shared Function GetFileSystemEntries (path As String, searchPattern As String) As String()

Parametreler

path
String

Aranacak dizinin göreli veya mutlak yolu. Bu dize, büyük küçük harf duyarlı değildir.

searchPattern
String

içindeki dosya ve dizin pathadlarla eşleşecek arama dizesi. Bu parametre geçerli değişmez değer yolu ve joker karakter (* ve ?) karakterlerinin bir bileşimini içerebilir, ancak normal ifadeleri desteklemez.

Döndürülenler

String[]

Belirtilen arama ölçütleriyle eşleşen dosya adları ve dizin adları dizisi veya hiçbir dosya ya da dizin bulunamazsa boş bir dizi.

Özel durumlar

Çağıranın gerekli izni yok.

2.1'den eski .NET Framework ve .NET Core sürümleri: path sıfır uzunlukta bir dizedir, yalnızca boşluk içerir veya bir veya daha fazla geçersiz karakter içerir. yöntemiyle GetInvalidPathChars() geçersiz karakterleri sorgulayabilirsiniz.

-veya-

searchPattern geçerli bir desen içermiyor.

path veya searchPattern şeklindedir null.

Belirtilen yol, dosya adı veya her ikisi birden sistem tarafından tanımlanan en fazla uzunluğu aşıyor.

path bir dosya adıdır.

Belirtilen yol geçersiz (örneğin, eşlenmemiş bir sürücüde).

Örnekler

Aşağıdaki örnek, bir dize dizisini belirli bir konumda kullanıcı tarafından belirtilen filtreyle eşleşen tüm dosyaların adlarıyla doldurmak için yöntemini kullanır GetFileSystemEntries ve dizideki her dizeyi konsola yazdırır. Örnek, bu yöntemde ortak olan tüm hataları yakalayacak şekilde yapılandırılmıştır.

using namespace System;
class Class1
{
public:
   void PrintFileSystemEntries( String^ path )
   {
      try
      {
         
         // Obtain the file system entries in the directory path.
         array<String^>^directoryEntries = System::IO::Directory::GetFileSystemEntries( path );
         for ( int i = 0; i < directoryEntries->Length; i++ )
         {
            System::Console::WriteLine( directoryEntries[ i ] );

         }
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, \HelloServer'                  or contains invalid characters." );
      }
      catch ( System::IO::DirectoryNotFoundException^ ) 
      {
         System::Console::WriteLine(  "The path encapsulated in the \HelloServer'                  Directory object does not exist." );
      }

   }

   void PrintFileSystemEntries( String^ path, String^ pattern )
   {
      try
      {
         
         // Obtain the file system entries in the directory
         // path that match the pattern.
         array<String^>^directoryEntries = System::IO::Directory::GetFileSystemEntries( path, pattern );
         for ( int i = 0; i < directoryEntries->Length; i++ )
         {
            System::Console::WriteLine( directoryEntries[ i ] );

         }
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, \HelloServer'                  or contains invalid characters." );
      }
      catch ( System::IO::DirectoryNotFoundException^ ) 
      {
         System::Console::WriteLine(  "The path encapsulated in the \HelloServer'                  Directory object does not exist." );
      }

   }


   // Print out all logical drives on the system.
   void GetLogicalDrives()
   {
      try
      {
         array<String^>^drives = System::IO::Directory::GetLogicalDrives();
         for ( int i = 0; i < drives->Length; i++ )
         {
            System::Console::WriteLine( drives[ i ] );

         }
      }
      catch ( System::IO::IOException^ ) 
      {
         System::Console::WriteLine(  "An I/O error occurs." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }

   }

   void GetParent( String^ path )
   {
      try
      {
         System::IO::DirectoryInfo^ directoryInfo = System::IO::Directory::GetParent( path );
         System::Console::WriteLine( directoryInfo->FullName );
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, or \HelloServer'                  contains invalid characters." );
      }

   }

   void Move( String^ sourcePath, String^ destinationPath )
   {
      try
      {
         System::IO::Directory::Move( sourcePath, destinationPath );
         System::Console::WriteLine(  "The directory move is complete." );
      }
      catch ( ArgumentNullException^ ) 
      {
         System::Console::WriteLine(  "Path is a null reference." );
      }
      catch ( System::Security::SecurityException^ ) 
      {
         System::Console::WriteLine(  "The caller does not have the \HelloServer'                  required permission." );
      }
      catch ( ArgumentException^ ) 
      {
         System::Console::WriteLine(  "Path is an empty String, \HelloServer'                  contains only white spaces, \HelloServer'                  or contains invalid characters." );
      }
      catch ( System::IO::IOException^ ) 
      {
         System::Console::WriteLine(  "An attempt was made to move a \HelloServer'                  directory to a different \HelloServer'                  volume, or destDirName \HelloServer'                  already exists." );
      }

   }

};

int main()
{
   Class1 * snippets = new Class1;
   String^ path = System::IO::Directory::GetCurrentDirectory();
   String^ filter =  "*.exe";
   snippets->PrintFileSystemEntries( path );
   snippets->PrintFileSystemEntries( path, filter );
   snippets->GetLogicalDrives();
   snippets->GetParent( path );
   snippets->Move(  "C:\\proof",  "C:\\Temp" );
   return 0;
}
using System;

namespace GetFileSystemEntries
{
    class Class1
    {
        static void Main(string[] args)
        {
            Class1 snippets = new Class1();

            string path = System.IO.Directory.GetCurrentDirectory();
            string filter = "*.exe";

            snippets.PrintFileSystemEntries(path);
            snippets.PrintFileSystemEntries(path, filter);		
            snippets.GetLogicalDrives();
            snippets.GetParent(path);
            snippets.Move("C:\\proof", "C:\\Temp");
        }

        void PrintFileSystemEntries(string path)
        {
            
            try
            {
                // Obtain the file system entries in the directory path.
                string[] directoryEntries =
                    System.IO.Directory.GetFileSystemEntries(path);

                foreach (string str in directoryEntries)
                {
                    System.Console.WriteLine(str);
                }
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, " +
                    "or contains invalid characters.");
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                System.Console.WriteLine("The path encapsulated in the " +
                    "Directory object does not exist.");
            }
        }
        void PrintFileSystemEntries(string path, string pattern)
        {
            try
            {
                // Obtain the file system entries in the directory
                // path that match the pattern.
                string[] directoryEntries =
                    System.IO.Directory.GetFileSystemEntries(path, pattern);

                foreach (string str in directoryEntries)
                {
                    System.Console.WriteLine(str);
                }
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, " +
                    "or contains invalid characters.");
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                System.Console.WriteLine("The path encapsulated in the " +
                    "Directory object does not exist.");
            }
        }

        // Print out all logical drives on the system.
        void GetLogicalDrives()
        {
            try
            {
                string[] drives = System.IO.Directory.GetLogicalDrives();

                foreach (string str in drives)
                {
                    System.Console.WriteLine(str);
                }
            }
            catch (System.IO.IOException)
            {
                System.Console.WriteLine("An I/O error occurs.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
        }
        void GetParent(string path)
        {
            try
            {
                System.IO.DirectoryInfo directoryInfo =
                    System.IO.Directory.GetParent(path);

                System.Console.WriteLine(directoryInfo.FullName);
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, or " +
                    "contains invalid characters.");
            }
        }
        void Move(string sourcePath, string destinationPath)
        {
            try
            {
                System.IO.Directory.Move(sourcePath, destinationPath);
                System.Console.WriteLine("The directory move is complete.");
            }
            catch (ArgumentNullException)
            {
                System.Console.WriteLine("Path is a null reference.");
            }
            catch (System.Security.SecurityException)
            {
                System.Console.WriteLine("The caller does not have the " +
                    "required permission.");
            }
            catch (ArgumentException)
            {
                System.Console.WriteLine("Path is an empty string, " +
                    "contains only white spaces, " +
                    "or contains invalid characters.");	
            }
            catch (System.IO.IOException)
            {
                System.Console.WriteLine("An attempt was made to move a " +
                    "directory to a different " +
                    "volume, or destDirName " +
                    "already exists.");
            }
        }
    }
}
open System
open System.IO
open System.Security

let printFileSystemEntries path =
    try
        // Obtain the file system entries in the directory path.
        let directoryEntries = Directory.GetFileSystemEntries path

        for str in directoryEntries do
            printfn $"{str}"
    with 
    | :? ArgumentNullException ->
        printfn "Path is a null reference."
    | :? SecurityException ->
        printfn $"The caller does not have the required permission."
    | :? ArgumentException ->
        printfn $"Path is an empty string, contains only white spaces, or contains invalid characters."
    | :? DirectoryNotFoundException ->
        printfn $"The path encapsulated in the Directory object does not exist."

let printFileSystemEntriesPattern path pattern =
    try
        // Obtain the file system entries in the directory
        // path that match the pattern.
        let directoryEntries = Directory.GetFileSystemEntries(path, pattern)

        for str in directoryEntries do
            printfn $"{str}"
    with
    | :? ArgumentNullException -> printfn "Path is a null reference."
    | :? SecurityException -> printfn "The caller does not have the required permission."
    | :? ArgumentException -> printfn "Path is an empty string, contains only white spaces, or contains invalid characters."
    | :? DirectoryNotFoundException -> printfn "The path encapsulated in the Directory object does not exist."

// Print out all logical drives on the system.
let getLogicalDrives () =
    try
        let drives = Directory.GetLogicalDrives()

        for str in drives do
            printfn $"{str}"
    with
    | :? IOException -> printfn "An I/O error occurs."
    | :? SecurityException -> printfn "The caller does not have the required permission."

let getParent path =
    try
        let directoryInfo = Directory.GetParent path
        printfn $"{directoryInfo.FullName}"

    with
    | :? ArgumentNullException -> printfn "Path is a null reference."
    | :? ArgumentException -> printfn "Path is an empty string, contains only white spaces, or contains invalid characters."

let move sourcePath destinationPath =
    try
        Directory.Move(sourcePath, destinationPath)
        printfn "The directory move is complete."

    with
    | :? ArgumentNullException -> printfn "Path is a null reference."
    | :? SecurityException -> printfn "The caller does not have the required permission."
    | :? ArgumentException -> printfn "Path is an empty string, contains only white spaces, or contains invalid characters."
    | :? IOException -> printfn "An attempt was made to move a directory to a different volume, or destDirName already exists."

let path = Directory.GetCurrentDirectory()
let filter = "*.exe"

printFileSystemEntries path
printFileSystemEntriesPattern path filter
getLogicalDrives ()
getParent path
move "C:\\proof" "C:\\Temp"
Option Explicit On 
Option Strict On

Namespace GetFileSystemEntries
    Class Class1
        Overloads Shared Sub Main(ByVal args() As String)
            Dim snippets As New Class1()
            Dim path As String = System.IO.Directory.GetCurrentDirectory()
            Dim filter As String = "*.exe"
            snippets.PrintFileSystemEntries(path)
            snippets.PrintFileSystemEntries(path, filter)
            snippets.GetLogicalDrives()
            snippets.GetParent(path)
            snippets.Move("C:\proof", "C:\Temp")
        End Sub

        Sub PrintFileSystemEntries(ByVal path As String)
            Try
                ' Obtain the file system entries in the directory path.
                Dim directoryEntries As String()
                directoryEntries = System.IO.Directory.GetFileSystemEntries(path)
                Dim str As String
                For Each str In directoryEntries
                    System.Console.WriteLine(str)
                Next str
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                        "required permission.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                        "contains only white spaces, " + _
                                        "or contains invalid characters.")
            Catch exp As System.IO.DirectoryNotFoundException
                System.Console.WriteLine("The path encapsulated in the " + _
                                        "Directory object does not exist.")
            End Try
        End Sub
        Sub PrintFileSystemEntries(ByVal path As String, _
                                   ByVal pattern As String)
            Try
                ' Obtain the file system entries in the directory
                ' path that match the pattern.
                Dim directoryEntries As String()
                directoryEntries = _
                   System.IO.Directory.GetFileSystemEntries(path, pattern)

                Dim str As String
                For Each str In directoryEntries
                    System.Console.WriteLine(str)
                Next str
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                        "required permission.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                        "contains only white spaces, " + _
                                        "or contains invalid characters.")
            Catch exp As System.IO.DirectoryNotFoundException
                System.Console.WriteLine("The path encapsulated in the " + _
                                        "Directory object does not exist.")
            End Try
        End Sub

        ' Print out all logical drives on the system.
        Sub GetLogicalDrives()
            Try
                Dim drives As String()
                drives = System.IO.Directory.GetLogicalDrives()

                Dim str As String
                For Each str In drives
                    System.Console.WriteLine(str)
                Next str
            Catch exp As System.IO.IOException
                System.Console.WriteLine("An I/O error occurs.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                           "required permission.")
            End Try
        End Sub
        Sub GetParent(ByVal path As String)
            Try
                Dim directoryInfo As System.IO.DirectoryInfo
                directoryInfo = System.IO.Directory.GetParent(path)
                System.Console.WriteLine(directoryInfo.FullName)
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                     "contains only white spaces, or " + _
                                     "contains invalid characters.")
            End Try
        End Sub
        Sub Move(ByVal sourcePath As String, ByVal destinationPath As String)
            Try
                System.IO.Directory.Move(sourcePath, destinationPath)
                System.Console.WriteLine("The directory move is complete.")
            Catch exp As ArgumentNullException
                System.Console.WriteLine("Path is a null reference.")
            Catch exp As System.Security.SecurityException
                System.Console.WriteLine("The caller does not have the " + _
                                           "required permission.")
            Catch exp As ArgumentException
                System.Console.WriteLine("Path is an empty string, " + _
                                        "contains only white spaces, " + _
                                        "or contains invalid characters.")
            Catch exp As System.IO.IOException
                System.Console.WriteLine("An attempt was made to move a " + _
                                        "directory to a different " + _
                                        "volume, or destDirName " + _
                                        "already exists.")
            End Try
        End Sub
    End Class
End Namespace

Açıklamalar

Döndürülen dosya ve dizin adlarının sırası garanti değildir; Sort belirli bir sıralama düzeni gerekiyorsa yöntemini kullanın.

searchPattern değişmez karakter ve joker karakterlerin birleşimi olabilir, ancak normal ifadeleri desteklemez. içinde aşağıdaki joker karakter tanımlayıcılara izin verilir searchPattern.

Joker karakter tanımlayıcısı Eşleşmeler
* (yıldız işareti) Bu konumdaki sıfır veya daha fazla karakter.
? (soru işareti) Bu konumda tam olarak bir karakter.

Joker karakter dışındaki karakterler değişmez karakterlerdir. Örneğin, searchPattern "*t" dizesi "t" harfiyle biten tüm adları path arar. searchPattern"s*" dizesi, "s" harfiyle başlayan tüm adları path arar.

searchPattern iki noktayla ("..") sona eremez veya iki nokta ("..") ve ardından DirectorySeparatorChar veya AltDirectorySeparatorCharile bitemez veya geçersiz karakter içeremez. yöntemini kullanarak GetInvalidPathChars geçersiz karakterleri sorgulayabilirsiniz.

Not

"*.txt" gibi bir searchPattern yıldız joker karakteri kullandığınızda, belirtilen uzantıdaki karakter sayısı aramayı aşağıdaki gibi etkiler:

  • Belirtilen uzantı tam olarak üç karakter uzunluğundaysa, yöntem belirtilen uzantıyla başlayan uzantılara sahip dosyaları döndürür. Örneğin, "*.xls" hem "book.xls" hem de "book.xlsx" döndürür.
  • Diğer tüm durumlarda yöntemi, belirtilen uzantıyla tam olarak eşleşen dosyaları döndürür. Örneğin, "*.ai" "file.ai" döndürür ancak "file.aif" döndürmez.

Soru işareti joker karakterini kullandığınızda, bu yöntem yalnızca belirtilen dosya uzantısıyla eşleşen dosyaları döndürür. Örneğin, bir dizindeki "file1.txt" ve "file1.txtother" adlı iki dosyada"dosya?.txt" arama deseni yalnızca ilk dosyayı döndürürken, "dosya*.txt" arama deseni her iki dosyayı da döndürür.

parametresinin path göreli veya mutlak yol bilgilerini belirtmesine izin verilir. Göreli yol bilgisi, geçerli çalışma dizinine göre yorumlanır. Geçerli çalışma dizinini edinmek için bkz GetCurrentDirectory. .

parametresinin path büyük/küçük harf duyarlılığı, kodun üzerinde çalıştığı dosya sistemine karşılık gelir. Örneğin, NTFS'de (varsayılan Windows dosya sistemi) büyük/küçük harfe duyarlı değildir ve Linux dosya sistemlerinde büyük/küçük harfe duyarlıdır.

Yaygın G/Ç görevlerinin listesi için bkz. Ortak G/Ç Görevleri.

Ayrıca bkz.

Şunlara uygulanır

GetFileSystemEntries(String, String, EnumerationOptions)

Kaynak:
Directory.cs
Kaynak:
Directory.cs
Kaynak:
Directory.cs

Belirtilen yoldaki arama deseni ve numaralandırma seçenekleriyle eşleşen dosya adları ve dizin adları dizisini döndürür.

public:
 static cli::array <System::String ^> ^ GetFileSystemEntries(System::String ^ path, System::String ^ searchPattern, System::IO::EnumerationOptions ^ enumerationOptions);
public static string[] GetFileSystemEntries (string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions);
static member GetFileSystemEntries : string * string * System.IO.EnumerationOptions -> string[]
Public Shared Function GetFileSystemEntries (path As String, searchPattern As String, enumerationOptions As EnumerationOptions) As String()

Parametreler

path
String

Aranacak dizinin göreli veya mutlak yolu. Bu dize, büyük küçük harf duyarlı değildir.

searchPattern
String

içindeki alt dizin pathadlarla eşleşecek arama dizesi. Bu parametre geçerli değişmez değer ve joker karakterlerin bir bileşimini içerebilir, ancak normal ifadeleri desteklemez.

enumerationOptions
EnumerationOptions

Kullanılacak arama ve numaralandırma yapılandırmasını açıklayan bir nesne.

Döndürülenler

String[]

Belirtilen arama düzeni ve numaralandırma seçenekleriyle eşleşen dosya adları ve dizin adları dizisi ya da dosya veya dizin bulunamazsa boş bir dizi.

Özel durumlar

Çağıranın gerekli izni yok.

2.1'den eski .NET Framework ve .NET Core sürümleri: path sıfır uzunlukta bir dizedir, yalnızca boşluk içerir veya bir veya daha fazla geçersiz karakter içerir. yöntemiyle GetInvalidPathChars() geçersiz karakterleri sorgulayabilirsiniz.

-veya-

searchPattern geçerli bir desen içermiyor.

path veya searchPattern şeklindedir null.

Belirtilen yol, dosya adı veya her ikisi birden sistem tarafından tanımlanan en fazla uzunluğu aşıyor.

path bir dosya adıdır.

Belirtilen yol geçersiz (örneğin, eşlenmemiş bir sürücüde).

Açıklamalar

Döndürülen dosya ve dizin adlarının sırası garanti değildir; Sort belirli bir sıralama düzeni gerekiyorsa yöntemini kullanın.

searchPattern değişmez karakter ve joker karakterlerin birleşimi olabilir, ancak normal ifadeleri desteklemez. içinde aşağıdaki joker karakter tanımlayıcılara izin verilir searchPattern.

Joker karakter tanımlayıcısı Eşleşmeler
* (yıldız işareti) Bu konumda sıfır veya daha fazla karakter.
? (soru işareti) Bu konumda tam olarak bir karakter var.

Joker karakter dışındaki karakterler değişmez karakterlerdir. Örneğin, searchPattern "*t" dizesi "t" harfiyle biten tüm adları path arar. searchPattern"s*" dizesi, "s" harfiyle başlayan tüm adları path arar.

searchPattern iki noktayla ("..") sona eremez veya iki nokta ("..") ve ardından DirectorySeparatorChar veya AltDirectorySeparatorCharile bitemez veya geçersiz karakter içeremez. yöntemini kullanarak GetInvalidPathChars geçersiz karakterleri sorgulayabilirsiniz.

Not

"*.txt" gibi bir searchPattern içinde yıldız joker karakteri kullandığınızda, belirtilen uzantıdaki karakter sayısı aramayı aşağıdaki gibi etkiler:

  • Belirtilen uzantı tam olarak üç karakter uzunluğundaysa, yöntem belirtilen uzantıyla başlayan uzantılara sahip dosyaları döndürür. Örneğin, "*.xls" hem "book.xls" hem de "book.xlsx" döndürür.
  • Diğer tüm durumlarda yöntemi, belirtilen uzantıyla tam olarak eşleşen dosyaları döndürür. Örneğin, "*.ai" "file.ai" döndürür ancak "file.aif" döndürmez.

Soru işareti joker karakterini kullandığınızda, bu yöntem yalnızca belirtilen dosya uzantısıyla eşleşen dosyaları döndürür. Örneğin, bir dizindeki "file1.txt" ve "file1.txtother" adlı iki dosyada "dosya?.txt" arama deseni yalnızca ilk dosyayı döndürürken, "dosya*.txt" arama deseni her iki dosyayı da döndürür.

parametresinin path göreli veya mutlak yol bilgilerini belirtmesine izin verilir. Göreli yol bilgisi, geçerli çalışma dizinine göre yorumlanır. Geçerli çalışma dizinini edinmek için bkz GetCurrentDirectory. .

parametresinin path büyük/küçük harf duyarlılığı, kodun üzerinde çalıştığı dosya sistemininkine karşılık gelir. Örneğin, NTFS'de (varsayılan Windows dosya sistemi) büyük/küçük harfe duyarlı değildir ve Linux dosya sistemlerinde büyük/küçük harfe duyarlıdır.

Yaygın G/Ç görevlerinin listesi için bkz. Ortak G/Ç Görevleri.

Şunlara uygulanır

GetFileSystemEntries(String, String, SearchOption)

Kaynak:
Directory.cs
Kaynak:
Directory.cs
Kaynak:
Directory.cs

Belirtilen yoldaki bir arama deseni ile eşleşen tüm dosya adlarından ve dizin adlarından oluşan bir dizi döndürür ve isteğe bağlı olarak alt dizinlerde arama gerçekleştirir.

public:
 static cli::array <System::String ^> ^ GetFileSystemEntries(System::String ^ path, System::String ^ searchPattern, System::IO::SearchOption searchOption);
public static string[] GetFileSystemEntries (string path, string searchPattern, System.IO.SearchOption searchOption);
static member GetFileSystemEntries : string * string * System.IO.SearchOption -> string[]
Public Shared Function GetFileSystemEntries (path As String, searchPattern As String, searchOption As SearchOption) As String()

Parametreler

path
String

Aranacak dizinin göreli veya mutlak yolu. Bu dize, büyük küçük harf duyarlı değildir.

searchPattern
String

içindeki dosya ve dizin pathadlarla eşleşecek arama dizesi. Bu parametre geçerli değişmez değer yolu ile joker karakter (* ve ?) karakterlerin bir bileşimini içerebilir, ancak normal ifadeleri desteklemez.

searchOption
SearchOption

Arama işleminin yalnızca geçerli dizini mi yoksa tüm alt dizinleri mi içermesi gerektiğini belirten numaralandırma değerlerinden biri. TopDirectoryOnly varsayılan değerdir.

Döndürülenler

String[]

Belirtilen arama ölçütleriyle eşleşen dosya adlarını ve dizin adlarını içeren bir dosya dizisi veya dosya veya dizin bulunamazsa boş bir dizi.

Özel durumlar

2.1'den eski .NET Framework ve .NET Core sürümleri: path sıfır uzunlukta bir dizedir, yalnızca boşluk içerir veya geçersiz karakterler içerir. yöntemini kullanarak GetInvalidPathChars() geçersiz karakterleri sorgulayabilirsiniz.

-veya-

searchPattern geçerli bir desen içermiyor.

path, null değeridir.

-veya-

searchPattern, null değeridir.

searchOption geçerli SearchOption bir değer değil.

path , eşlenmemiş bir sürücüye başvurmak gibi geçersizdir.

path bir dosya adıdır.

Belirtilen yol, dosya adı veya birleştirilmiş, sistem tanımlı uzunluk üst sınırını aşıyor.

Çağıranın gerekli izni yok.

Çağıranın gerekli izni yok.

Açıklamalar

Döndürülen dosya ve dizin adlarının sırası garanti değildir; Sort belirli bir sıralama düzeni gerekiyorsa yöntemini kullanın.

searchPattern değişmez karakter ve joker karakterlerin birleşimi olabilir, ancak normal ifadeleri desteklemez. içinde aşağıdaki joker karakter tanımlayıcılara izin verilir searchPattern.

Joker karakter tanımlayıcısı Eşleşmeler
* (yıldız işareti) Bu konumda sıfır veya daha fazla karakter.
? (soru işareti) Bu konumda tam olarak bir karakter var.

Joker karakter dışındaki karakterler değişmez karakterlerdir. Örneğin, searchPattern "*t" dizesi "t" harfiyle biten tüm adları path arar. searchPattern"s*" dizesi, "s" harfiyle başlayan tüm adları path arar.

searchPattern iki noktayla ("..") sona eremez veya iki nokta ("..") ve ardından DirectorySeparatorChar veya AltDirectorySeparatorCharile bitemez veya geçersiz karakter içeremez. yöntemini kullanarak GetInvalidPathChars geçersiz karakterleri sorgulayabilirsiniz.

Not

"*.txt" gibi bir searchPattern içinde yıldız joker karakteri kullandığınızda, belirtilen uzantıdaki karakter sayısı aramayı aşağıdaki gibi etkiler:

  • Belirtilen uzantı tam olarak üç karakter uzunluğundaysa, yöntem belirtilen uzantıyla başlayan uzantılara sahip dosyaları döndürür. Örneğin, "*.xls" hem "book.xls" hem de "book.xlsx" döndürür.
  • Diğer tüm durumlarda yöntemi, belirtilen uzantıyla tam olarak eşleşen dosyaları döndürür. Örneğin, "*.ai" "file.ai" döndürür ancak "file.aif" döndürmez.

Soru işareti joker karakterini kullandığınızda, bu yöntem yalnızca belirtilen dosya uzantısıyla eşleşen dosyaları döndürür. Örneğin, bir dizindeki "file1.txt" ve "file1.txtother" adlı iki dosyada "dosya?.txt" arama deseni yalnızca ilk dosyayı döndürürken, "dosya*.txt" arama deseni her iki dosyayı da döndürür.

EnumerateFileSystemEntries ve GetFileSystemEntries yöntemleri aşağıdaki gibi farklılık gösterir: kullandığınızdaEnumerateFileSystemEntries, tüm koleksiyon döndürülmeden önce girdi koleksiyonunu numaralandırmaya başlayabilirsiniz; kullandığınızdaGetFileSystemEntries, diziye erişebilmeniz için tüm girdi dizisinin döndürülmesini beklemeniz gerekir. Bu nedenle, birçok dosya ve dizinle EnumerateFileSystemEntries çalışırken daha verimli olabilir.

Göreli yol bilgilerini parametresiyle path belirtebilirsiniz. Göreli yol bilgileri, yöntemini kullanarak belirleyebileceğiniz geçerli çalışma dizinine GetCurrentDirectory göre yorumlanır.

Ayrıca bkz.

Şunlara uygulanır