Intranet shared drive access

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • mafranks
    Forum Member
    • Jul 2004
    • 19

    Intranet shared drive access

    I have an AMS 5.0 application that gets folder file information from our company's intranet shared drive:

    files = File.Find("S:\\SAFETY\\Bulletins", "*.*", false, false, nil);

    This worked fine until I discovered that some of our computers have the shared drive mapped as "E" or "T" or some other letter. I cannot request they all remap their computers to "S" for the shared drive as some are already using "S" for some other purpose. Anyway, we have over a hundred computers at our site and I have no idea how many have or do not have "S" mapped as their shared drive.

    Does anyone know a way I can rewrite the above code to find the SAFETY folder and it's subfolders no matter which drive letter our 'shared' drive is ID'd to?

    One more piece of information. Our shared drive, while using MS explorer, will always be indentified by something like: lnlcc20$ on 'usldcvs(S. Of course you wold replace the 'S' with 'E' or 'T' or whatever the individual's mapped drive letter would be. Thanks for any help.
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3967

    #2
    You could use UNC

    \\ComputerName\\ShareName

    For instance, if the computer name was: Computer1
    and the folder was shared as: Safety

    You could do this:

    files = File.Find("\\\\Computer1\\SAFETY\\Bulletins", "*.*", false, false, nil);

    Comment

    • SUF6NEWBIE

      #3
      Try this (for true mapped Network Drives)

      CODE:

      Get_Drives_T = Drive.Enumerate(); --function to return all network drives

      for drvindex, drives in Get_Drives_T do
      drive_type = Drive.GetType(drives);
      if (drive_type == 4) then --is a network drive
      --the drive letter will be returned as eg: S:\
      --add here file.find and or a folder.find actions
      --to locate your target id folder\files and you should be all set
      --when located add an if statement to break out of loop.
      if .... then
      break;
      end
      end
      end

      end --end of function

      hope this helps a little
      (having trouble getting the code to show a better layout..sorry)
      Last edited by Guest; 10-12-2004, 02:51 PM.

      Comment

      • Worm
        Indigo Rose Customer
        • Jul 2002
        • 3967

        #4
        SUF6NEWBIE,

        You can use
        (code)

        Your Code block here

        (/code)


        Substitute square bracket [ ] for the parenthesis ( )



        Originally posted by SUF6NEWBIE
        Try this (for true mapped Network Drives)

        CODE:

        Get_Drives_T = Drive.Enumerate(); --function to return all network drives

        for drvindex, drives in Get_Drives_T do
        drive_type = Drive.GetType(drives);
        if (drive_type == 4) then --is a network drive
        --the drive letter will be returned as eg: S:\
        --add here file.find and or a folder.find actions
        --to locate your target id folder\files and you should be all set
        --when located add an if statement to break out of loop.
        if .... then
        break;
        end
        end
        end

        end --end of function

        hope this helps a little
        (having trouble getting the code to show a better layout..sorry)

        Comment

        • SUF6NEWBIE

          #5
          neat trick WORM...tks --wierd the correct layout would not
          transfer to 'forum display' ....some 'tab' issues at my end.

          Comment

          • mafranks
            Forum Member
            • Jul 2004
            • 19

            #6
            Thanks for your help

            Worn's code worked fine. All I had to do was change:

            files = File.Find("\\\\Computer1\\SAFETY\\Bulletins", "*.*", false, false, nil);

            to:

            files = File.Find("\\\\usldcvs1fsh02\\lnlccf20$\\SAFETY\\B ulletins", "*.*", false, false, nil);

            Thanks for the help.

            Oh, one last question. Why the \\\\ instead of just \\ ???

            Thanks

            Comment

            • Worm
              Indigo Rose Customer
              • Jul 2002
              • 3967

              #7
              The first backslash is an escape character to the scripting engine. When it encounters a backslash, it interprets the next character (i.e. \t is equal to tab, \n is a newline). So to have a backslash within your string, you need to double them up because the first one is the escape character, the second one is the actual character. So, to show two backslashes, you must use 4.

              or something like that

              Comment

              • mafranks
                Forum Member
                • Jul 2004
                • 19

                #8
                Thanks Worm

                Worm, thanks again.

                Comment

                Working...
                X