WIN

  • 26 May

    Move 1 file to 1 location and another file to a different location

    Q: Is it possible to move 1 file to 1 location and another file to a different location but only when a file with a specific extension is present? I’m processing a job where I create a data file with print information and a PDFfile,  in the Main location there will be .csv file

    Main Location

    .csv

    At some point a pdf file will appear in the main location i.e.

    .csv

    .pdf

    Can I create a rule where

    1. It only starts when a .pdf is present
    2. Moves the .pdf file to 1 location and the .csv file to a different location?

    A: Yes this is possible using a bit of Pascal Script. We added some screenshots from an example to get you started.

    • We added a local Windows folder as Source:

    Limagito File Mover Source Setup

    • Important is to add the following FileName Include Filters. We’ll scan for ‘*.csv’ and ‘*.pdf’ files.

    Limagito File Mover Filename Include Filter

    • Open the Pascal Script option:

    Limagito File Mover Pascal Script option

    • Enable and Add the following ‘On Rule Begin’ Pascal Script:
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSA := '';
    End.

    Limagito File Mover Pascal Script

    • Enable and Add the following ‘On Destination’ Pascal Script:
    Var
      tmpExt: String;
      tmpFile: String;
    Begin
      psExitCode := 0;
      // ... add your code here
      tmpExt := ExtractFileExt(psFileName);
      // Check for pdf if csv exists
      If tmpExt = '.csv' Then
      Begin
        tmpFile := psStringReplace(psFileName, tmpExt, '.pdf');
        If FileExists(psFilePath + tmpFile) or (Pos(psFilePath + tmpFile, psVSA) <> 0) Then
        Begin
          psLogWrite(1, '', 'File ' + tmpFile + ' Exists');
          psVSA := psVSA + ';' + psFilePath + psFileName;
          psExitCode := 1;
        End;
      End;
      // Check for csv if pdf exists
      If tmpExt = '.pdf' Then
      Begin
        tmpFile := psStringReplace(psFileName, tmpExt, '.csv');
        If FileExists(psFilePath + tmpFile) or (Pos(psFilePath + tmpFile, psVSA) <> 0)  Then
        Begin
          psLogWrite(1, '', 'File ' + tmpFile + ' Exists');
          psVSA := psVSA + ';' + psFilePath + psFileName;
          psExitCode := 1;
        End;
      End;
    End.

    Limagito File Mover Pascal Script

    • Enable and Add the following ‘On Destinations‘ Pascal Script:
    Begin
      psExitCode := -1;
      // .csv files to Destination ID1
      If (psDestinationID = 'ID1') And (ExtractFileExt(psFileName) = '.csv') Then
        psExitCode := 1;
      // .pdf files to Destination ID2    
      If (psDestinationID = 'ID2') And (ExtractFileExt(psFileName) = '.pdf') Then
        psExitCode := 1;
    End.
    

    Limagito File Mover another file to a different location

    • Add two Destinations. Important, the first Destination (ID1) should receive hte csv files and the second Destination (ID2) should receive the pdf files.

    Limagito File Mover Destination Setup

    • RunTime Log Result. The Csv file goes to the first Destination and only when a pdf file with the same name exists. The pdf file itself goes to the second Destination.

    Limagito File Mover RunTime Log

    #Filetransfer #Filemanagement

    If you need any info about this request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script WIN
  • 10 Feb

    Send different on success or failure notifications based on file type

    Q: Is it possible in the same moving rule to have it send different on success or failure notifications based on file type. For example I only want it to send a notification if it is a pdf file extension. Other files in the job would still copy but only notify on the pdfs. I am working on a group wide project and it would help out a lot. The PDF file extension was just an example and would be other file formats.

    A: We added a new option ‘Use Pascal Script as event Precondition’ in Version v2022.2.9.0

    – Open Rule Events Setup

    Limagito File Mover Pascal Script Setup

    – Select the Event you want to setup (in our example this is the ‘On Success’ event) > Options Tab > Enable ‘Use Pascal Script as event Precondition’

    Limagito File Mover Pascal Script Use Pascal Script As Precondition

    – Switch to ‘Pascal Script’ Tab and Enable Pascal Script.
    – Add the following script to include only .pdf files for the ‘On Success’ event. This is just a simple example but can be extended to meet all your needs.

    Begin
      // ... add your code here
      If SameText(ExtractFileExt(psFileName), '.pdf') Then
        psExitCode := 1
      Else
        psExitCode := 0;
    End.

    Limagito File Mover Rule Events Pascal Script

    #Filetransfer

    If you need any info about this ‘notifications based on file type’ option, please let us know.

    Best regards,

    Limagito Team

  • 06 Feb

    Maximum number of files in Destination folder

    Q: Maximum number of files in Destination folder. I have a short question. Very nice if You have an answer 🙂

    One Source Windows folder: “IN”.
    One Destination Windows folder: “OUT”
    The number of files in the folder “OUT” should never exceed 3 files.

    (The files will be processed and deleted from the “OUT” folder by other software. When the number of remaining files is 0, 1 or 2, Limagito should send one more file).

    Is there an solution/function for this in Limagito File Mover?

    A: Yes this is possible using a small Pascal Script.

    This script will only work with WIN as Destination. Enable and add ‘On Rule Begin’ Pascal Script. Don’t forget to adjust the ‘ctFilter, ctOutputPath and ctSubDirs’ Const.

    Limagito File Mover Pascal Script option

    Var
      tmpCount: Integer;
    Const
      ctFilter = '*.pdf';
      ctOutputPath = 'C:\Test\Out\Sub1\';
      ctSubDirs = True; // True or False
    Begin
      psExitCode := 1;
      // ... add your code here
      tmpCount := psCountFiles(ctOutputPath, ctFilter, ctSubDirs);
      // Check
      If tmpCount >= 3 Then
      Begin
        psExitCode := 0;
        psLogWrite(1, '', 'QTY Files &gt;= 3 (Count: ' + IntToStr(tmpCount) + ')');
      End;  
    End.

    Limagito File Mover Maximum Files in Destination

    Feedback customer:

    Fantastic! I´ve did some simple tests and it seems to work exactly as we wanted.

    #Filetransfer

    If you need any info about this ‘Maximum number of files’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script WIN , ,
1 2 3 4 5 6 7 8 10
SEARCH