Exists(filename) slowing down?

Has anyone else had experience with using the C/Side function Exists(filename)? In particular I’m using it in a report to determine if a file exists in a directory and if so perform a certain action. When the directory had a few hundred files, the report took minutes, now that it has thousands of files, it’s taking hours. No other changes we’re made to the system (I haven’t lost a crtical index or changes the report). Can Exists() slow down that much? Michael Hogan

Hi Since this function directly access hard disk it may slow. I think the following reasons may casue the performance of Exists() function. 1) The Target directory is not a default directory of Navision. 2) The Target directory is a network directory and is not maped to your local disk. For a testing copy all the files in the target directory into your local hard disk and try to run the report. Then you can compare the time taken for both cases. Regards Joseph Mathew

Michael Why not just move or rename the old files after they have been used? This will cut down the search time for the file exists as it will only have the active files to search through! The same as a table the fewer the filtered records the faster the search! David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

Hello The report I’m running populates a Navision table to indicate whether a jpg image and/or html file of the item exists. (actually up to three sizes of each image (50 pixel, 100 pixel and 200 pixel, plus a html file - the names are generated from the navision No. with appropriate suffixes) The files are stored on a network drive as several users feeding the directory. What worked efficiently when there were a hundred files in the directory has become unwieldy with thousands. I’m exploring other alternatives to populate the field, namley an external Delphi app to create a dataimport wih the approprate values.

Have you tried the File virtual table (number 2000000022)? This will give you a list of all files in the specified directory. You can run through this list and update your Navision table as necesssary.