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. check if file exists with wild char in file name

check if file exists with wild char in file name

Scheduled Pinned Locked Moved C#
6 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.
  • L Offline
    L Offline
    lune12
    wrote on last edited by
    #1

    Hi, Is there a possibility to do something like

    if (File.Exists("*.txt"))
    {...}

    Thanks

    L T 2 Replies Last reply
    0
    • L lune12

      Hi, Is there a possibility to do something like

      if (File.Exists("*.txt"))
      {...}

      Thanks

      L Offline
      L Offline
      lune12
      wrote on last edited by
      #2

      Thanks

      D 1 Reply Last reply
      0
      • L lune12

        Thanks

        D Offline
        D Offline
        dojohansen
        wrote on last edited by
        #3

        Then share it with the world - the forum doesn't exist just for you!

        L 1 Reply Last reply
        0
        • L lune12

          Hi, Is there a possibility to do something like

          if (File.Exists("*.txt"))
          {...}

          Thanks

          T Offline
          T Offline
          teejayem
          wrote on last edited by
          #4

          Use the Directory.GetFiles[^] method.

          Don't be overcome by evil, but overcome evil with good

          L 1 Reply Last reply
          0
          • D dojohansen

            Then share it with the world - the forum doesn't exist just for you!

            L Offline
            L Offline
            lune12
            wrote on last edited by
            #5

            you are right...

            DirectoryInfo dir = new DirectoryInfo (Directory.getCurrentDirectory());
            foreach (FileInfo f in dir.GetFiles("*.txt"))
            {
            ....
            }

            1 Reply Last reply
            0
            • T teejayem

              Use the Directory.GetFiles[^] method.

              Don't be overcome by evil, but overcome evil with good

              L Offline
              L Offline
              lune12
              wrote on last edited by
              #6

              Thanks, it's what i used.

              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