Q: I have a task that needs to grab sets of files. Pdf files that have “A01” and “A06” OR files that have “A01” and A08” in their filename. Could this be accomplished?
A: So you would like us to check if pdf file A08 is available and if so then grab pdf files with A01 and A08 in their filename. If pdf file A08 is not available check the same but then using A06 in the filename. Meaning a set of files and grabbing the first and last page pdf file. Yes, this is possible.
- As Source we will use a windows folder. This folder will contain the pdf files.
- In the ‘File Filter’ we are going to use the ‘File Name Include’ filter option. Add the parameter %VSA to this filter. This %VSA (Var String A) will get its value from a script that we will add in the next step.
- In the ‘Advanced’ tab of the ‘File Filter Setup’ we need to enable ‘Allow parameters in File Name Filter’.
- Next, please open the ‘Pascal Script’ option:
- Enable and add the following ‘On Rule Begin’ script:
Begin psExitCode:= 0; // ... add your code here psLogWrite(1, '', 'Source Path: ' + psSourcePath); If psCountFiles(psSourcePath, '*A08*.pdf', False) >= 1 Then Begin psLogWrite(1, '', 'Found A08'); psVSA := '*A01*.pdf;*A08*.pdf'; psExitCode:= 1; End Else Begin If psCountFiles(psSourcePath, '*A06*.pdf', False) >= 1 Then Begin psLogWrite(1, '', 'Found A06'); psVSA := '*A01*.pdf;*A06*.pdf'; psExitCode:= 1; End; End; End.
- As Destination we used a Windows folder:
- First test with 6 pdf files in the Source, A01 to A06
- RunTime log result, only pdf file A01 and A06 are copied:
- Second test with 6 pdf files in the Source, A01 to A08
- RunTime log result, only pdf file A01 and A08 are copied:
If you need any help with this ‘grab sets of files’ request, please let us know.
Best Regards,
Limagito Team
#filetransfer #filemanagement