Link to home
Start Free TrialLog in
Avatar of jtran007
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
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);
            }

Open in new window

SOLUTION
Avatar of saragani
saragani

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jtran007
jtran007

ASKER

It's really fast.
Thanks gentlemen.
JT