Is there a way to check whether a certain directory exists?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a way to check whether a certain directory exists?

    There is a way to check whether a file exists:

    Code:
    V19        =FILE/EXISTS,"C:\ARCHIVE\PN"+PARTNAME+"SN"+SERIALNUMBER+"\CHECK_FILE_DO_NOT_DELETE.TXT"
    Is there also a simple way to check whether a directory exists?

    If I try to create a directory through a script and the directory already exists, I get an error that my operator needs to respond to. I am trying to get rid of this error message by trying to check whether that directory already exists, and if so, then skip the directory generation process.


    Any ideas welcome, Thanks, Jan.
    ***************************
    PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
    Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

  • #2
    It can be done with VB script (Dir) but I know from an earlier post of yours you are in the same boat as me and can no longer run them. Thanks B&S.
    <internet bumper sticker goes here>

    Comment


    • #3
      How come you can no longer run them?
      sigpic

      Comment


      • #4
        Yours quit working the same way, with this “Error Executing Basic Script! C:\xxxxx.BAS:MAIN” message? I can test mine and they give no errors. Then when I call them in my program, they fail... all the same way.

        I loaded all kinds of version on that computer and they all fail. Then I installed on another computer, and it is running again. I may have corrupted something in XP.

        It seems to me that RussL is right, I may have to reload XP. Not sure yet. Still waiting for some more feedback from Hexagon.


        Jan.
        ***************************
        PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
        Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

        Comment


        • #5
          Yeah I get that error just like you. Normally I get an error with a line number where the error (my sytax problem usually) occured but this error just says "Error Executing Basic Script! C:\xxxxx.BAS:MAIN" like you. I can run "play" them from the editor but not run them in a program execution. I pulled my hair out forever and eventually gave up. Then I saw your post.

          It sux
          <internet bumper sticker goes here>

          Comment


          • #6
            Code:
            V1         =FILE/EXISTS,C:\MRCOMMENT\[B]*.*[/B]
                        COMMENT/OPER,NO,V1
            Hi Jan d.

            Try using the wildcard "*.*" for your filename when you use File Exists.

            Seems to work for me in this example.
            Mr. Comment
            SCIROCCO-NT 13-20-10
            B3C-LC Controller (Leitz Protocol), SP600M, TP200
            PCDMIS CAD++ v4.3 MR1(Build: 12/11/08)
            sigpic

            Comment


            • #7
              Your're the man, MrComment!!!!!

              Originally posted by MrComment View Post
              Code:
              V1         =FILE/EXISTS,C:\MRCOMMENT\[B]*.*[/B]
                          COMMENT/OPER,NO,V1
              Hi Jan d.

              Try using the wildcard "*.*" for your filename when you use File Exists.

              Seems to work for me in this example.
              Works like a charm.

              Admin, we need those reputations back. MrComment deserves a few.



              Jan.
              ***************************
              PC-DMIS/NC 2010MR3; 15 December 2010; running on 18 machine tools.
              Romer Infinite; PC-DMIS 2010 MR3; 15 December 2010.

              Comment

              Related Topics

              Collapse

              Working...
              X