I have a report, “read files” that is reading file(s) in the c:\import\ folder
abc.txt
cde.txt etc
After processing the files I need to move or rename them.
From the threads I have read, it seems that I would have to run another report, “rename files” on exit that will rename all the files.
It does not seem possible to do the rename (or move) from the “readfiles” report as it still has the file open until it exits.
Any ideas on how to do this without the use of “rename files” report?
My quick and dirty solution is to RUN the processing report and then RENAME the files.
- OnPreDataItem()
RESET;
SETRANGE(“Is a file”,TRUE);
SETFILTER(Path,TEMPORARYPATH);
FINDFIRST;
SETFILTER(Path,‘c:\import’);
SETFILTER(Name,’@*.txt’);
- OnAfterGetRecord()
FileName := Path + Name;
FileName2 := FileName + ‘.FIN’;
REPORT.RUN(50006);
FILE.RENAME(FileName,FileName2);