File Mover Blog

  • 04 Aug

    Destination Folder Routing with Limagito File Mover

    Q: Destination Folder Routing. I have a question about copying files to specific destinations depending on the name of the file. In the example filename below, depending on the file name, files should be copied to a specific folder. Specifically, if the file name has range “21181058” to “21181062” (bold part in the example filename) then it should go into Folder1. If the file name has range “21181022” to “21181037” then it should go to Folder2.

    • XYZ-21181058-123456789-001.xls

    A: Yes, this is possible using some custome Pascal Script that we created for you. Some screenshots to get you started:

    • Open our Pascal Script option:

    Limagito File Mover Pascal Script

    • Add and enable the following OnDestinations Pascal Script:
    Var
      tmpValue: Integer;
      tmpPart: String;
    Begin
      psExitCode:= 0;
      // CRL-21181022-12022725-001
      tmpPart := Copy(psFileName, 5, 8);
      psLogWrite(0, '', 'Stripped from filename: ' + tmpPart);
      tmpValue := StrToIntDef(tmpPart, 0);
      If tmpValue = 0 Then
      Begin
       psLogWrite(0, '', 'Stripped value from filename not correct: ' + tmpPart);
       Exit;
      End;
      // If the file name has range “21181058” to “21181062” than to Folder1.
      If (psDestinationID = 'ID1') Then
      Begin
        If (tmpValue >= 21181058) And (tmpValue <= 21181062) Then 
          psExitCode := 1 
        Else
          psExitCode := -1; 
      End; 
      // If the file name has range “21181022” to “21181037” than to Folder2.
      If (psDestinationID = 'ID2') Then 
      Begin 
        If (tmpValue >= 21181022) And (tmpValue <= 21181037) Then
          psExitCode := 1
        Else
          psExitCode := -1;
      End;
      // Out of Range
      If psExitCode = 0 Then
        psLogWrite(0, '', 'Stripped value from filename out of range: ' + tmpPart);
    End.
    

    Limagito Fole Mover Pascal Script

    • Add your two destinations:

    Limagito File Mover Destinations

    • RunTime Log Result:

    Limagito File Mover Runtime Log

    If you need any help with this 'Destination Folder Routing' option, please let us know.

    Best Regards,

    Limagito Team

    #filetransfer #filemanagement

  • 31 Jul

    Second API Vendor for ZIP and UNZIP operations

    Second API Vendor for ZIP and UNZIP operations was added in version v2022.7.31.0

    The reason we added this second (UN)ZIP source code provider is that on some occasions we had exception issues when trying to add multiple source files to a single destination zip file. It seems this second API Vendor (third party code provider) handles this better.

    Limagito File Mover ZIP and UNZIP operations

    If you need any help with this second API Vendor, please let us know.

    Best Regards,

    Limagito Team

    #filetransfer #zip

    By Limagito-Team ZIP ,
  • 21 Jul

    I am looking for a way to incorporate date logic

    Q: I am looking for a way to incorporate date logic within our Limagito installation. I believe the easiest way to do this would be to use a Pascal Script, however I have not been able to find a syntax guide to assist me.

    The date logic would be used in two places in a single rule that is run on a schedule. The first is in the file filter. Rule executes, I need to look for files that meet the pattern: NV_mmddyyyy.pdf where mmddyyyy is the date for the upcoming Friday.

    • If it ran today (July 20, 2022), I would be looking for the filename that matched NV_07222022.pdf

    The second place is in the path to the destination directory. The path looks like: c:\Jobs\mmdd_NV_WK\HotFolders\ where mmdd is the date for the upcoming Friday.

    • If it ran today (July 20, 2022, the path would look like: c:\Jobs\0722_NV_WK\HotFolders\

    Can you help us create a Pascal Script or provide us with a resource that has a syntax guide?

    A: Could you please try the following:

    First enable and add the following ‘On Destination’ Pascal Script

    Limagito File Mover Pascal Script

     
    Var
      tmpDay: TDateTime;
    
    Function GetNextFriday: TDateTime;
    Var
      iDay: Integer;
      tmpDate: TDateTime;
    Begin
      Result := 0;
      tmpDate := Now;
      For iDay := 0 to 6 Do
      begin
        tmpDate := tmpDate + iDay;
        // Check if Friday (= 5)
        If DayOfTheWeek(tmpDate) = 5 Then
        Begin
          Result := tmpDate;
          Break;
        End;
      End;
    End; 
    
    Begin
      psExitCode:= 1;
      // ... add your code here
      tmpDay := GetNextFriday;
      If tmpDay <> 0 Then
      Begin
        psVSA := FormatDateTime('MMDDYYYY', tmpDay);
        psVSB := FormatDateTime('MMDD', tmpDay);
      End
      Else
        psExitCode:= 0;  
    End.
    

    Limagito File Mover Pascal Script

    Next we need to adjust the File Filter Setup. The ‘Include Filename Filter’ will use the %VSA var (%VSA = Var String A) that was set in the previous Pascal Script.

    Limagito File Mover File Filter

    Important, do not forget to enable ‘Allow parameters in File Name filter (File Filter > Advanced Tab)

    Limagito File Mover File Filter

    Next, open Destination Setup and double click on your Destination:

    Limagito File Mover Destinations

    lect File & Directory Tab and adjust ‘Create SubDir, opt.’ to  %VSB_NV_WK\HotFolders\%SFS
    Again we will use a Pascal Script var (%VSB) that was set by the ‘On Destination’ Pascal Script.

    Limagito File Mover Destination Setup

    RunTime Log Result:

    Limagito File Mover RunTime Log

    #Filetransfer #Filemanagement

    If you need any info about this ‘incorporate date logic’ question, please let us know.

    Best regards,

    Limagito Team

1 38 39 40 41 42 43 44 136
SEARCH