By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

Directory.GetFiles for multi-language file names?

P: n/a
cjb
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.
Sep 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

cIs there a way to get Directory.GetFiles to return multi-language
cfile names? I haven't found any overloads that allow any such
cparameter. The way I am using it now is:
c>
cforeach (string d in Directory.GetDirectories("C:\\")) {
cforeach (string f in Directory.GetFiles(d, "*.exe")) {
cMessageBox.Show(f);
c}
c}
cThis will get all files except for the ones that do not have English
cfile 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
Sep 27 '06 #2

P: n/a
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
cIs there a way to get Directory.GetFiles to return multi-language
cfile names? I haven't found any overloads that allow any such
cparameter. The way I am using it now is:
c>
cforeach (string d in Directory.GetDirectories("C:\\")) {
cforeach (string f in Directory.GetFiles(d, "*.exe")) {
cMessageBox.Show(f);
c}
c}
cThis will get all files except for the ones that do not have English
cfile 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
Sep 27 '06 #3

P: n/a
cjb
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!

"Michael Nemtsev" wrote:
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

cIs there a way to get Directory.GetFiles to return multi-language
cfile names? I haven't found any overloads that allow any such
cparameter. The way I am using it now is:
c>
cforeach (string d in Directory.GetDirectories("C:\\")) {
cforeach (string f in Directory.GetFiles(d, "*.exe")) {
cMessageBox.Show(f);
c}
c}
cThis will get all files except for the ones that do not have English
cfile 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
Sep 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.