UweKeim / ZetaLongPaths

A .NET library to access files and directories with more than 260 characters length.
https://nuget.org/packages/ZetaLongPaths
MIT License
141 stars 28 forks source link

Pattern format #30

Closed CanadianHusky closed 3 years ago

CanadianHusky commented 3 years ago

Hello,

I think this is an easy Question : What is the expected pattern format ? The .NET Standard GetFiles() function takes a string array. The ZLP Libary is expecting a regular string.

How do I specify multiple file extension , for example ".pdf, .jpg, *.docx"?

Public Function GetFiles(pattern As String, searchOption As SearchOption) As ZlpFileInfo()

Great Library! Well Done!

UweKeim commented 3 years ago

Could you tell me the documentation reference to the Directory.GetFiles() with a string array input parameter?

I've tried to search the documentation, but found no overload of Directory.GetFiles() that has the signature you mentioned.

To answer your actual question:

You have to run the GetFiles() multiple times, one call for each wildcard pattern. (This is the same behaviour as the original [Directory.GetFiles()](https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=net-5.0)).

CanadianHusky commented 3 years ago

Sure, here is the VB Overload

https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.fileio.filesystem.getfiles?view=net-5.0#Microsoft_VisualBasic_FileIO_FileSystem_GetFiles_System_String_Microsoft_VisualBasic_FileIO_SearchOption_System_String___

and here in action in VS image

CanadianHusky commented 3 years ago

I did a workaround, run search with *.* and filter out un/wanted patterns using a hashtable lookup, cause it is faster than running a search on a very deep directory more than once.

thank you for the prompt response...Dankeschön