Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
where abc= newfolder\file1.deploy
File.Exists(abc)
{
// File
}


Its not Detecting File :(
Posted
Comments
Karthik Harve 18-Apr-13 3:00am    
that means file does not exists. have you verified with the complete path of the file ?
Joezer BH 18-Apr-13 3:01am    
Can you show us the actual code?

* The File.Exists obviously works correctly
Friendsaa 18-Apr-13 3:54am    
I know my file is there,
my file name is like this "label_me_red.deploy"
Joezer BH 18-Apr-13 4:24am    
How about showing the actual code then?
Friendsaa 18-Apr-13 5:16am    
"label_me_red.ico.deploy" is string from StreamReader.ReadLine()
if(File.Exists("label_me_red.ico.deploy"))
{
// File
}
else
{
// Folder
}

1 solution

You are using relative path here. Are you sure your current path is the one you think it is?
Use Directory.GetCurrentDirectory[^] method to check.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900