Q: I am looking to move txt files to a location. If the line count is more than 1 (more than just a header) move to processing.
A: Yes this is possible using some Pascal Script.
1. Be sure that you will only handle text files. We’ve added a File Name Include Filter:
2.Please open the ‘Pascal Script’ option:
3. Enable and Add the following ‘On Destination’ Pascal Script. You can choose between 0 or -1 as result for psExitCode var. 0 will give an error when such a file is found, -1 will skip such a file.
Var tmpFile: String; tmpList: TStringList; Begin psExitCode:= 1; // ... add your code here tmpFile := psFilePath + psFileName; tmpList := TStringList.Create; Try Try tmpList.LoadFromFile(tmpFile); If tmpList.Count < 2 Then Begin // Invalid count psExitcode := -1; // := -1 is Skip File and := 0 is Error on File psLogWrite(1, '', 'Invalid recordcount in ' + tmpfile); End; Except // Error psExitCode := 0; psLogWrite(1, '', 'Error loading ' + tmpfile); End; Finally tmpList.Free; End; End.
4. RunTime Log
If you need any info about this ‘line count is more than’ request, please let us know.