Files in Folder - read at regular intervals.

rchikkarchikka Member Posts: 23
Hi All,

We are doing some integration work w.r.t xml data exchange.

An external system places files in folder ( for ex : the path is D:\import )
I m reading a folder , which has xml files, at 10 min interval using this code.

recdir.RESET;
recdir.SETRANGE(Path,gettextpath()); // ( gettextpath function gets the path as D:\Import )
recdir.SETRANGE("Is a file",TRUE);
IF recdir.FIND('-') THEN
REPEAT
CU1.ImportFile(Txtpath + '\' + recdir.Name);
CU1.CopyFiles(SSetup.CustomerImportPath,SSetup.CompletedCustomerPath,recdir.Name);
UNTIL recdir.NEXT =0

I will be calling a codeunit ( CU1) which calls the xml port.

Now first time the folder does have 2 xml ( say xmlfile1 and xmlfile 2 ) files and i have read them successfully and imported into the database and deleted these 2 files.

now my above code gets executed once again but this time, its not refreshing , its not identifying new files in the folder but always refers to the same old file which has been read and deleted.
so my code stops here.

Kindly suggest how to proceed on this.

Regards,
chikka.

Comments

Sign In or Register to comment.