#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2002
    Posts
    570
    Rep Power
    60

    Create local folder using WMI, C#.net


    Hey all,

    I've been googling for about an hour now and am still have some problems. I want to be able to create a folder on my (local) computer using C# and then set permissions for it. Any ideas?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2009
    Posts
    837
    Rep Power
    527
    You need to set ACL's programmatically?

    try this:
    http://www.west-wind.com/weblog/posts/4072.aspx

    Also be sure and have a look at the "FileIOPermission" MSDN help topic, as well as "requesting permissions" and how to use permview.exe.

    Declaring these permissions is a way to make .NET apps easier to administer; the assembly manifest will contain information regarding the required filesystem/network access.

    An admin can use permview on the assembly in order to determine proper network and file permissions needed by the app.
    Last edited by MadDogBrown; June 22nd, 2009 at 12:04 PM.
  4. #3
  5. ASP.Net MVP
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Aug 2003
    Location
    WI
    Posts
    4,378
    Rep Power
    1511
    I'm curious as to the 'why' of this. .Net provides a number of ways for reading and writing to files within the existing accepted file systems standards. What are you trying to do? Perhaps there is a more-correct way to do it.
    Primary Forum: .Net Development
    Holy cow, I'm now an ASP.Net MVP!

    [Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers]

    http://twitter.com/jcoehoorn
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0
    To create a folder using C#

    first include the IO : using System.IO

    then put this code in a button or whatever you want

    Code:
    string path = "type your path here " ;
    
    Directory.CreateDirectory(path);

IMN logo majestic logo threadwatch logo seochat tools logo