I need to check for whether the file folder is created in successfully in C#. How to?

Posted on 2011-10-03
Last Modified: 2012-05-12
Hi there;

I need to check for whether the file folder is created in successfully in C#.

I mean i need to have a function whether the file is created successfully, return true or return false.

Same for different function checking for folder creation.

Kind regards.
Question by:jazzIIIlove
    LVL 22

    Accepted Solution


    bool exists = System.IO.Directory.Exists(@"c:\myPath");
    LVL 12

    Author Comment

    I want to check not the exist case.

    I just want to create a directory and if the creation fails or not.

    Kind regards.
    LVL 22

    Expert Comment

    after the  create process run the code i gave you checking if exist will prove whether it was created successfully or not :)
    LVL 12

    Author Comment

    Ehm. You are right.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now