Is it possible to check in a cfg file if d: / MS_connect exists and if not check if c: / MS-connect exists and put the following variable MS_DATA_HOORN to that path?

Is it possible to check in a cfg file if d: / MS_connect exists and if not check if c: / MS-connect exists and put the following variable MS_DATA_HOORN to that path?

Parents
  • Hi,

    ms_connect is a directory with organization data and therefore exists on the D: or on the C: drive.

    I want to test in a cfg file if there is a D: / ms_connect directory. If so, then ms_data_hoorn = D: / ms_connect must be set and if it is not there, it must be checked whether c: / ms_connect exists. if yes then ms_data_hoorn = C: / ms_connect must be set.

    if exists d: / ms_connect
    set ms_data_horn = D: / ms_connect
    else ms_data_horn = C: / ms_connect
    or something

  • Hi Nico,

    as Mary wrote: Did you bother to study documentation Mary linked? Plus, did you try to use Search? The same question was discussed many times already (both for folders and files), so answer is available already (e.g. this one).

    I want to test in a cfg file if there is a D: / ms_connect directory

    Why did you choose to do not follow standards and to use syntax not used anywhere? It's like a decision "I want to create something confusing and annoying." We are on Windows, so a file path consists from backslashes, plus no spaces exists around a drive specification. So why you simply do not write D:\ms_connect\? Or, when you prefer to use style used in MicroStation configuration files (which is also perfectly fine), to write D:/ms_connect/?

    Also, it's recommended to use ending backslash, when folder is specified, because from C:\ms_connect it's not clear whether it's folder or file (with no extension), whereas when C:\ms_connect\ is used, it's clear.

    then ms_data_hoorn = D: / ms_connect must be set and if it is not there, it must be checked whether c: / ms_connect exists. if yes then ms_data_hoorn = C: / ms_connect must be set.

    Your (pseudo)code does something different. I do not see any test whether C:\ms_connect\ exists or not.

    I guess this should work:

    %if exists(D:/ms_connect/)
      ms_data_horn = D:/ms_connect/
    %elif exists (C:/ms_connect/)
      ms_data_horn = C:/ms_connect/
    %endif

    Regards,

      Jan

    Answer Verified By: Marc Thomas 

Reply Children
No Data