You can also try the Automation object Microsoft Scripting Runtime. It contains a COM object called the FileSystemObject. This gives you full control of directory/file queries and file/directory management. It contains a method called FileExists, among many other useful methods.
EXISTS (File)
Use this function to determine if a file exists.
[Ok :=] File.EXISTS(Name)
Ok
Data type: boolean
This return value tells you whether or not the file exists.
Ok will be...
If the file...
TRUE Exists
FALSE Does not exist
Function FExist(pPath:Text[1000]):boolean;
var
FileList: record 2000000022;
begin
FileList.SETRANGE(Path, pPath);
FileList.SETRANGE("Is a File",true);
FileList.SETFILTER(Name,'*.txt');
exit(FileList.FIND('-'));
end;
Code was written from the scratch. Can be there some mistakes... 8)
Comments
Arhontis
https://forum.mibuso.com/search
Arhontis
https://forum.mibuso.com/search
Code was written from the scratch. Can be there some mistakes... 8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.