Directory.GetFiles for multi-language file names?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to get Directory.GetFiles to return multi-language file names?
I haven't found any overloads that allow any such parameter. The way I am
using it now is:

foreach (string d in Directory.GetDirectories("C:\\")) {
foreach (string f in Directory.GetFiles(d, "*.exe")) {
MessageBox.Show(f);
}
}

This will get all files except for the ones that do not have English file
names. Any help would be much apprecaited. Thanks you.
 
Hello cjb,

Are u sure that you non-english file has .exe extension?
Because there is nothing wrong with this code, it shows any kind of language
name files

c> Is there a way to get Directory.GetFiles to return multi-language
c> file names? I haven't found any overloads that allow any such
c> parameter. The way I am using it now is:
c>
c> foreach (string d in Directory.GetDirectories("C:\\")) {
c> foreach (string f in Directory.GetFiles(d, "*.exe")) {
c> MessageBox.Show(f);
c> }
c> }
c> This will get all files except for the ones that do not have English
c> file names. Any help would be much apprecaited. Thanks you.
c>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Hello cjb,

Hello cjb,

Are u sure that your non-english file has .exe extension?
Because there is nothing wrong with this code, it shows any kind of language
name files


c> Is there a way to get Directory.GetFiles to return multi-language
c> file names? I haven't found any overloads that allow any such
c> parameter. The way I am using it now is:
c>
c> foreach (string d in Directory.GetDirectories("C:\\")) {
c> foreach (string f in Directory.GetFiles(d, "*.exe")) {
c> MessageBox.Show(f);
c> }
c> }
c> This will get all files except for the ones that do not have English
c> file names. Any help would be much apprecaited. Thanks you.
c>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
I figured out my problem, thanks to a posting by someone in another forum.
What I didn't realize was that my snippet there didn't actually return files
underneath C:\.

I was pointed to use:

for each (string d in Directory.GetFiles("C:\\", "*.exe",
SearchOptions.AllDirectories)) {
MessageBox.Show(d);
}

That overloaded GetFiles function traverses all of the sub-directories and
it pulls all of the files in the top level as well.

Thanks for taking the time to respond. Hopefully this posting will help
someone else and they won't beat themselves up like I did thinking that it
wouldn't find multi-language file names!
 
Back
Top