jtran007
asked on
Check directory exists
Hi Expert,
I try to create a directory if it does not exist. However, my program always
see the directory exist even it does not exist.
Could you help?
Thx,
JT
I try to create a directory if it does not exist. However, my program always
see the directory exist even it does not exist.
Could you help?
Thx,
JT
DateTime dt = DateTime.Now;
string today = "c:\\rate\\" + dt.ToString("yyyyMMdd");
if (!System.IO.Directory.Exists(today))
{
MessageBox.Show("The directory " + today + " already exists!");
}
else
{
// @ is like a kind of escape.
// Directory.CreateDirectory(@"C:\" + today);
Directory.CreateDirectory(today);
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks gentlemen.
JT