• 29 May

    Specify to copy the second most recent file

    Q: Can you recommend any way using Limagito, that we can specify to copy the second most recent file, i.e. at midnight today, copy the file from midnight yesterday? So the creation of a new file in the folder would trigger the copying of the previous file.
    A client of ours has recently licensed Limagito. The primary use is for transferring text files from an equipment server to a historian server, where it can be processed. We have one use case that is a bit tricky, and we are hoping that you can help with it. The source equipment produces an audit trail text file, which captures changes to the system on a continuous basis. The equipment creates the file every 24 hours, at midnight. Until now, we had been copying this file at midnight, to transfer for processing. The rule we use identifies when a new file is created, and copies this new file. We assumed that the file held the audit trail records for the previous 24 hour. But what is actually the case is that the equipment creates the file at midnight, and then continuously writes to the file for the next 24 hours, and creates a new (blank) file again the next midnight. So the files that we were copying were blank, or only held a few lines of data.
    So a little bit more info. Our client has previously been using different file mover software. They have only recently licensed Limagito. So currently, we are using that different software, but because they now have a Limagito license, we want to use Limagito instead,
    So currently, we have a rule set up (in the other software) which will detect when a new file is added/created in the source folder, and copy that file to the destination folder. So to answer your question, the equipment creates a new file in the source folder at midnight, which is initially blank, but it will write to that file at regular intervals for the subsequent 24 hours. But yes, as you say, we do a copy when the file appears for the first time. So the rule we use monitors the folder for new files, and copies a new file when it appears. What we want to do, is copy the file that was created 24 hours ago.

    A: In this case we could trigger the rule at for example 5 minutes past midnight and use a ‘File Date Include Filter’ of older than 1 day.

    • Please disable the Scan Timers in the ‘Schedule’ Setup:

    Limagito File Mover Disable Timers

    • Enable ‘Use Scheduler’ and Add the following ‘5 minutes past midnight’ schedule:

    Limagito File Mover Scheduler

    Limagito File Mover Once a day schedule

    • Because we are using a ‘Once a day’ trigger it is very important not to enable the ‘Stabilized File Check’ option. The reason is that this option needs at least two triggers because it needs to check if a file size is growing between triggers/scans or not.

    Limagito File Mover Stabilized file check

    • Add the following ‘File Date Include’ filter. Be sure to enable ‘Data Relative’ as File Date Filter Reference.

    Limagito File Mover copy the second most recent file

     

    #Filetransfer #Filemanagement

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

    Best regards,

    Limagito Team

  • 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
1 2 3 4
SEARCH