Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. directory in c#

directory in c#

Scheduled Pinned Locked Moved C#
csharphelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saqib82
    wrote on last edited by
    #1

    Hi i am trying to check for the existance of a directory using C# but don't know exact format to use it. My.Computer.FileSystem.DirectoryExists("C:\\directoryname") can someone help me by guiding me to the exact way of knowing the existance of directory. regards

    sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

    A C 2 Replies Last reply
    0
    • S saqib82

      Hi i am trying to check for the existance of a directory using C# but don't know exact format to use it. My.Computer.FileSystem.DirectoryExists("C:\\directoryname") can someone help me by guiding me to the exact way of knowing the existance of directory. regards

      sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

      A Offline
      A Offline
      abhinish
      wrote on last edited by
      #2

      hi! try this DirectoryInfo dr1 = new DirectoryInfo("c:\\dirname"); if (dr1.Exists) { MessageBox.Show("Directory Exists") }

      abhinav

      1 Reply Last reply
      0
      • S saqib82

        Hi i am trying to check for the existance of a directory using C# but don't know exact format to use it. My.Computer.FileSystem.DirectoryExists("C:\\directoryname") can someone help me by guiding me to the exact way of knowing the existance of directory. regards

        sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        saqib82 wrote:

        My.Computer.FileSystem.DirectoryExists("C:\\directoryname")

        This is VB, VB has nasty shortcuts ( nasty because they don't flow to C# ). if (System.IO.Directory.Exists(@"c:\Directoryname")) { // Whatever } The @ allows you to type \ without having to do \\

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        S 1 Reply Last reply
        0
        • C Christian Graus

          saqib82 wrote:

          My.Computer.FileSystem.DirectoryExists("C:\\directoryname")

          This is VB, VB has nasty shortcuts ( nasty because they don't flow to C# ). if (System.IO.Directory.Exists(@"c:\Directoryname")) { // Whatever } The @ allows you to type \ without having to do \\

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

          S Offline
          S Offline
          saqib82
          wrote on last edited by
          #4

          Thanks christian, i was trying to do something like we do in vb. But finally i did the same thing that you have suggested. Sorry you are late, but thanks again for your help. regards

          sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups