SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member shivanee's Avatar
    Join Date
    May 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to remove directories and subdirectories from the path specified using c# winform

    Hello all,

    I want to remove the directories and subdirectories from the path specified using the c# winforms 2003.

    For ex:

    I am having the path like:

    C:\\Program Files\\Test\\all subdirectories, where, "Test"is my folder name and inside the "Test" folder there are some subdirectories.

    So, How do I delete the directories and subdirectories from the path specified?

    Please help me out?

    Thanks in advance.

  2. #2
    Non-Member shivanee's Avatar
    Join Date
    May 2007
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Delete the data from the Folder and then delete folder using c# 2003

    Hello all,

    I have a file path like:

    "C:\\Test\\Test1"

    "Test1" folder is having some files and folders. So, first I want to delete that files and folders from the "Test1" folder and finally deletes the "Test1" folder from the spcified path.

    So, How can I do this using the C#.Net 2003 in winforms.

    I am doing like the following


    userAppData = "C:\\Test\\Test1";


    if (System.IO.Directory.Exists(userAppData))
    {
    System.IO.Directory.Delete(userAppData);
    }
    else
    {
    MessageBox.Show("Directory Does Not Exist");
    }
    It is getting that folder in the "IF" condition and the time of DELETE statement in "IF" condition,It is giving me an error as:

    "Test 1 folder is not empty".

    Please help me out.
    Thanks in advance.

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,625
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Please don't double post if you don't get an answer to your original question, it is a violation of forum rules.

    As for your question, you should go and look at the methods and classes in the System.IO namespace. Everything you need is there.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •