C# results FALSE at `File.Exists` even if the file EXISTS

.net, c#, winforms

Solution

It looks like your file is actually named `abc_RotateFlip.xml.xml`.

I can't imagine why any programmer would ever allow hidden file extensions, but your Excel file shows that they are indeed hidden. Turn that off! Choose to know what's going on inside your computer!

You can also use this registry script to change that setting;

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"HideFileExt"=dword:00000000

Problem

As title says I don't know what's wrong with my code but `if (File.Exists)` give negative result even if the file is there. Below is my code ``` if (File.Exists(ZFileConfig.FileName.Replace(".xml", "_abc.xml"))) ``` Here, `ZFileConfig.FileName` is `E:\\Application\\Application\\bin\\Debug\\resources\\FirstFile.xml` And amazingly `ZFileConfig.FileName.Replace(".xml", "_abc.xml")` gives me `E:\\Application\\Application\\bin\\Debug\\resources\\FirstFile_abc.xml` that is what is needed. EVENTHOUGH `IF` falied to return TRUE.

Original source

Related problems