hi all, some help is needed
one of our customers has a software which creates a file in a predefined path periodically (i. e. every 5 mins)
the name of the files follows the rule: txtFileName_yymmdd_hhmmss
we thougth to create a new directory for "processed files", to copy there all txt files processed in Nav. the processed files will be deleted from original path, in order to have here as less files as possible
we are looking for some code to read the name of the files in a directory from within Navision with some report or loop code from a codeunit, but we don't know how to return the name of the files, because never two files will be named equally due to date & time..
hope you understand what we want to explain...
regards
_______________
so far, so good
0
Answers
In NAV exists a virtual table "File"
WITH recFile DO BEGIN
RESET;
SETRANGE(Path,strPath);
SETRANGE("Is a file",TRUE);
IF FIND('-') THEN
REPEAT
MESSAGE(Name);
UNTIL NEXT = 0;
END;
THAAAAAAAAAAANKS A LOT!!! \:D/
regards
so far, so good
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Since Navision can't loop trough all the files in a folder the filenames are stored in a 'Microsoft Scripting Runtime'.Dictionary ( the FilesCol object), using the VBScript.
This vbScript gives the dictionary an integer and text value. The integer to loop, the text is the filename.
I found the vbScript here on Mibuso to loop trough folders : http://www.mibuso.com/forum/viewtopic.php?f=5&t=7855&hilit=folders
Just to know there are others ways ...
Variables are : ( all of type automation )
FilesCol : 'Microsoft Scripting Runtime'.Dictionary
Script : 'Microsoft Script Control 1.0'.ScriptControl
WHSFileSystemObject : 'Windows Script Host Object Model'.FileSystemObject
WHSFolder : 'Windows Script Host Object Model'.Folder
WHSFile : 'Windows Script Host Object Model'.File