how to find out if a directory exists?

guidorobbenguidorobben Member Posts: 157
If I want to know it this folder exist, and the folder does not exist, I always get a error message saying that the folder does not exists. This is not what I want. I use the below method...

//Files is record.file
Files.SETRANGE(Path, 'c:\Test folder\');
exit(Files.Count>0);

Comments

  • nuno.silvanuno.silva Member Posts: 29
    Hi,
    I usually only use thsi single instruction:

    IF EXISTS(path) THEN...
    ===============
    Nuno Silva
  • guidorobbenguidorobben Member Posts: 157
    This only works on Files, not on folders...Correct me if I'm wrong

    Guido
  • elToritoelTorito Member Posts: 191
    You can Intend make a file with :
    [Ok := ] File.CREATE(Name)
    Typ Boolean.
    

    If it was okay the directory where was create the File exists, if is not okay, something other happens :)

    Yes, i have try with EXISTS Path and really seems work only with filenames.

    Try make an Temp File in an Specified Folder, or Export something in a textfile. And if this runs or not decide if Folder exists.

    :roll:
    (Oo)=*=(oO)
  • guidorobbenguidorobben Member Posts: 157
    I thought of it myself.. But there are some limitations with this approach. If I can read a folder but not write it, I have a problem. Also I have no idea how this will work in Citrix.

    But i'll keep it in mind.

    btw, I Think I have solved the Folder thing. Now I'm working if a Drive Exists. This is a bit harder.

    :|
  • i4tosti4tost Member Posts: 208
    As an option you can create your own OCX and use it or try to find already created.
  • Morten_SolbergMorten_Solberg Member Posts: 24
    You can find a folder with an automation server.

    fso Automation 'Microsoft Scripting Runtime'.FileSystemObject
    ok Boolean
    strUrl Text

    IF NOT CREATE(fso,FALSE) THEN EXIT;
    strUrl := 'C:\Documents and Settings\All Users\';
    ok := fso.FolderExists(strurl);
    CLEAR(fso);
  • dennis_decoenedennis_decoene Member Posts: 13
    Could Navision's File virtual table not help you out on this?
    I don't need PGP, my handwriting suffices.
  • guidorobbenguidorobben Member Posts: 157
    I got it as far as figuring out if folders exists. But I have a problem with the drive letter part.

    guido
  • jreynoldsjreynolds Member Posts: 175
    Navision's file virtual table only supports 98 charater path names which is a serious limitation in today's world of longer folder and file names.
  • guidorobbenguidorobben Member Posts: 157
    The drives can be checked with the table Drive.. So I've don it. It works

    Guido
Sign In or Register to comment.