FileExists Error

Hi you experts.

I have a file that has ".." in it's name and for that i think FileExists cannot see the file even if it's there.
How can i prevent this? Is there another way to make sure tha a file exists?
LVL 1
adktdAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

flavoCommented:
This worked for me:

      System.IO.FileInfo file = new System.IO.FileInfo("C:/test..it.txt");
      MessageBox.Show(this,file.Exists.ToString());

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dkloeckCommented:
File.Exists works as well

using System.IO;

MessageBox.Show(File.Exists("C:\\a..N.txt").ToString() );
Bob LearnedCommented:
What about this--'..\..\test.txt'?  This file would have to exist 2 directories up from the current directory.

Bob
RoninTheCommented:
I'm not sure about this problem, I've encountered FileExists fails in another scenario. might be related to this prob.

If you have a folder with trailing space char, file.exists fails for anything in that path. Now, you can't make a folder like this ("j2sdk1.4.1_01 " - notice last whitespace) in Winxp anymore, such folder names must have been created in older Windows or non-Win OS. Even winexplorer failes to show properties of any file in such path.

@adktd, let me know if winexporer can show props of you file. if it does, it could be some coding error. if it can't, its an OS bug.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.