I hope this is going to be a simple question, with an equally obvious answer. I’m trying to find out if a Directory exists, without getting a Navision generated message. I have tried: - (a) the EXISTS functions, but this appears to work only for Files, not Directories. (b) using a FIND on the File table [2000000022]. This works, but Navision displays a “The operating system cannot find……” error.
Many Thanks. I went for Soren Nielsen’s solution: - DirExists(Directory : Text[250]) : Boolean CLEAR(objFilesystem); CREATE(objFilesystem); EXIT(objFilesystem.FolderExists(Directory)); where objFilesystem is type automation of ‘Microsoft Scripting Runtime.FileSystemObject’,’{420B2830-E718-11CF-893D-00A0C9054228}’,‘scrrun.dll’
You could also try “standard” Navision: EXISTS(‘C:\Windows\nul’);
Thank you, Anfinnur. I prefer this solution and have swapped the code over.