2013. 6. 9. 17:45
-
Can you call Directory.GetFiles() with multiple filters?
-
I am trying to use the Directory.GetFiles()
method to retrieve a list of files of multiple types, such as mp3
's and jpg
's. I have tried both of the following with no luck:
Directory.GetFiles("C:\\path", "*.mp3|*.jpg", SearchOption.AllDirectories);
Directory.GetFiles("C:\\path", "*.mp3;*.jpg", SearchOption.AllDirectories);
Is there a way to do this in one call?
-
105 |
edit: Please read the comments. The improvement that Paul Farry suggests, and the memory/performance issue that Christian.K points out are both very important. | |||
---------------------------------------------------------------------------------------------
14 | How about this:
I found it here (in the comments): http://msdn.microsoft.com/en-us/library/wz42302f.aspx | ||||||||||
|
-
-
'.NET > C#' 카테고리의 다른 글
ADO.NET Entity Model 짧은 강좌 (0) | 2013.06.18 |
---|---|
[스크랩] [영어 원문] C#: Currying (0) | 2013.06.12 |
[본문스크랩] C# cs단에서 MS-SQL 연결시도 (0) | 2013.05.11 |
[PDF] 비쥬얼 스튜디오 2010 C# 단축키 (0) | 2013.03.18 |
C# 공부할 때, 두르는 싸이트 (669) | 2013.02.03 |
s.ToLower().Endswith...
– Stormenet May 5 '10 at 9:35s.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase)
– Paul Farry May 31 '10 at 22:58Directory.GetFiles
withDirectory.EnumerateFiles
,msdn.microsoft.com/en-us/library/dd383571.aspx , which will avoid the memory issues that @Christian.K mentions. – Jim Mischel Dec 2 '11 at 22:58