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. Visual Basic
  4. Dir() function

Dir() function

Scheduled Pinned Locked Moved Visual Basic
sysadminquestion
8 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.
  • N Offline
    N Offline
    No e
    wrote on last edited by
    #1

    Is there a reason Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory) THe only difference beig one is a network drive, the other is not?

    L S 2 Replies Last reply
    0
    • N No e

      Is there a reason Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory) THe only difference beig one is a network drive, the other is not?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      No-e wrote:

      Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory)

      Try Dim mypath mypath = "\\RemoteHostName\ShareName" myname = Dir(MyPath, vbDirectory) Tell me whether it is working or not.

      N 1 Reply Last reply
      0
      • N No e

        Is there a reason Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory) THe only difference beig one is a network drive, the other is not?

        S Offline
        S Offline
        Steve Pullan
        wrote on last edited by
        #3

        Well without knowing the error you are receiving I'm guessing but perhaps the V: drive does not exist or you do not have sufficient authority to access that network resource? ...Steve 1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)

        L 1 Reply Last reply
        0
        • L Lost User

          No-e wrote:

          Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory)

          Try Dim mypath mypath = "\\RemoteHostName\ShareName" myname = Dir(MyPath, vbDirectory) Tell me whether it is working or not.

          N Offline
          N Offline
          No e
          wrote on last edited by
          #4

          This does not work either. I do not get an error, I just do not get anything for either case (using path or drive letter) Any other ideas?

          L 1 Reply Last reply
          0
          • N No e

            This does not work either. I do not get an error, I just do not get anything for either case (using path or drive letter) Any other ideas?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Try this code: Dim mypath mypath = "\\[IPAddressOfRemoteHost]\ShareName" myname = Dir(MyPath, vbDirectory) Example: Dim mypath mypath = "\\192.168.1.1\Report" myname = Dir(MyPath, vbDirectory)

            N 1 Reply Last reply
            0
            • S Steve Pullan

              Well without knowing the error you are receiving I'm guessing but perhaps the V: drive does not exist or you do not have sufficient authority to access that network resource? ...Steve 1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Steve Pullan wrote:

              Well without knowing the error you are receiving I'm guessing but perhaps the V: drive does not exist or you do not have sufficient authority to access that network resource?

              In my opinion, his computer is try to check for the remote host availability which usually know as name resolution. If this happend, i think he might waiting during the name resolution process in the stage of broadcast the signal for the remote host and waiting for an answer. If he do not have permission to access the resource, the message box should indicate him that access is denied.

              1 Reply Last reply
              0
              • L Lost User

                Try this code: Dim mypath mypath = "\\[IPAddressOfRemoteHost]\ShareName" myname = Dir(MyPath, vbDirectory) Example: Dim mypath mypath = "\\192.168.1.1\Report" myname = Dir(MyPath, vbDirectory)

                N Offline
                N Offline
                No e
                wrote on last edited by
                #7

                Thanks, but that is actually the way I tested it. mypath = "\\10.22.222.150\datadrive\logs" ' Set the path. myname = Dir(mypath, vbDirectory) ' Retrieve the first entry. Odd thing is that I do not get any error at all, just no answer.... I have tried several different computers, can not get anything across the network....

                L 1 Reply Last reply
                0
                • N No e

                  Thanks, but that is actually the way I tested it. mypath = "\\10.22.222.150\datadrive\logs" ' Set the path. myname = Dir(mypath, vbDirectory) ' Retrieve the first entry. Odd thing is that I do not get any error at all, just no answer.... I have tried several different computers, can not get anything across the network....

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Try to read this article[^]. You might get some idea from it.

                  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