sets of files

  • 01 Oct

    I have a task that needs to grab sets of files

    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.

    Limagito File Mover Source Setup

    • 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.

    Limagito File Mover File Filter Setup

    • In the ‘Advanced’ tab of the ‘File Filter Setup’  we need to enable ‘Allow parameters in File Name Filter’.

    Limagito File Mover File Filter Advanced

    • Next, please open the ‘Pascal Script’ option:

    Limagito File Mover Pascal Script

    • 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.

    Limagito File Mover Pascal Script Setup

    • As Destination we used a Windows folder:

    Limagito File Mover Destination Setup

    • First test with 6 pdf files in the Source, A01 to A06

    • RunTime log result, only pdf file A01 and A06 are copied:

    Limagito File Mover RunTime log

    • Second test with 6 pdf files in the Source, A01 to A08

    • RunTime log result, only pdf file A01 and A08 are copied:

    Limagito File Mover RunTime Log

    If you need any help with this ‘grab sets of files’ request, please let us know.

    Best Regards,

    Limagito Team

    #filetransfer #filemanagement

    By Limagito-Team Pascal Script
SEARCH