File Manipulation

CodeViperCodeViper Member Posts: 28
I am having an issue where I want to automatically read a file from a directory and I 'cant SEE the file' any longer after the client wanted the folder moved.
It used to run in that I would read from the Source Folder, import the file and then delete it from that directory and place it in the Destination Folder directory.

I understand the CLIENT --> NAV SERVER.

Running the code I had...

recFile is a global.. Datatype Record, subtype File
SourceFolder defined as text "C:\TEMP\Import\"
DestinationFolder defined as text "C:\TEMP\Import\Done"


CODE SNIPLET START
FileRoot := COPYSTR(SourceFolder, 1, 3);

CLEAR(recFile);
recFile.RESET;
recFile.SETRANGE("Is a file", TRUE);
recFile.SETFILTER(Path, SourceFolder);
IF recFile.FINDFIRST THEN BEGIN
recFile.SETFILTER(Path,'%1', SourceFolder);
recFile.SETFILTER(Name, '%1', '@*');

CODE SNIPLET END

So my code ran fine when the file was on that server.
But the client has large data storage issues.
So they got themselves a File Server.

So now the way I see it is...
CLIENT --> NAV SERVER --> FILE SERVER

I tried setting my SourceFolder as "\\svFileServer\TEMP\Import"
Ditto for the DestinationFolder as "\\svFileServer\TEMP\Import\Done"

I can use file explorer and see the files in the folder... but now when NAV runs, recFile.FindFirst returns nothing and there is no import done....

What gives? Wrong URL path?
Can I no longer use the NAV File record?

Any insight as to what I am missing would be greatly appreciated... as well as any code sniplets I could look at or reference would be great.

TIA!!

Aaron

Best Answer

Answers

Sign In or Register to comment.