• 24 Nov

    Q&A 47: Question regarding multiple source

    Q: Question regarding multiple source. I have to delete files from multiple paths. My filter rule (folder/files) is exactly the same this is why I would like to create one Limagito rule for more than one source. In the Source window, I can weite only one source…

    Limagito File Mover Multiple WIN as Source

    Is it possible to create one limagito rule for several source ?

    A: Yes (only) with WIN as Source separate them with ;

    For example:

    Limagito File Mover Multiple WIN as Source

    #FileTransfer

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

    Best regards,

    Limagito Team

    By Limagito WIN ,
  • 14 Nov

    I want to be able to Find in File text content. Is this possible ?

    Q: I want to be able to Find in File text content. Is this possible? For example, if the file contain a string in the file content, than do an operation. Is it possible in Limagito or we can only do something with the file name?

    In attachment, you will find folders and files example.

    –          If we find the string ST^832^ then we need to move the file in the folder « Price »

    –          If we find the string ST^810^ then we need to move the file in the folder « Invoice »

    So, the process should do this :

    –          Move the files !EDIFile.Exaple1 and !EDIFile.Example2 in folder « Price »

    –          Move the file ASSET.Example in folder « Invoice »

    A: Yes this is possible using a custom script which we create for you. I’ve added some screenshots to help you.

    • Source is a Windows folder:

    Limagito File Mover Windows Folder as Source

    • Open ‘Pascal Script’ Setup:

    Limagito File Mover Pascal Script option

    • Enable and add the following ‘On Destination’ Pascal Script:
    Var
      tmpFile: String;
      tmpList: TStringList;
    Const
      ctInvoiceSearch = 'ST^810^';
      ctPriceSearch = 'ST^832^';
      ctInvoiceSubDir = 'Invoice';
      ctPriceSubDir = 'Price';
    Begin
      psVSA := '';
      psExitCode:= 0;
      // ... add your code here
      tmpFile := psFilePath + psFileName;
      tmpList := TStringList.Create;
      Try
        Try
          tmpList.LoadFromFile(tmpFile);
          // Check Invoice
          If pos(ctInvoiceSearch, tmpList.Text) <> 0 Then
          Begin
            psVSA := ctInvoiceSubDir;
            psExitCode := 1;
            psLogWrite(1, '', 'Destination SubDir: ' + ctInvoiceSubDir + ' for ' +tmpFile);
          End;
          // Check Price
          If pos(ctPriceSearch, tmpList.Text) <> 0 Then
          Begin
            psVSA := ctPriceSubDir;
            psExitCode := 1;
            psLogWrite(1, '', 'Destination SubDir: ' + ctPriceSubDir + ' for ' + tmpFile);
          End;
          // Nothing was Found
          If psVSA = '' Then
          Begin
            psLogWrite(1, '', 'Destination SubDir Unknown for ' + tmpFile);
          End;
        Except
          psLogWrite(1, '', 'Error loading ' + tmpFile);
        End;
      Finally
        tmpList.Free;
      End;
    End.

    Limagito File Mover On Destination Pascal Script

    • Set Function to ‘Move Files’:

    Limagito File Mover Function Setup

    • Add ‘WIN’ as Destination

    Limagito File Mover Destination Selection

    • Select your Destination Directory:

    Limagito File Mover WIN as Destination Setup

    • Adjust the default ‘Create Subdir, option’ to:  %VSA\%SFS

    The reason you need to change this is because we’ want to use information from the previous Pascal Script to select the correct Subdirectory. In this example it will be ‘Price’ or ‘Invoice’.

    Limagito File Mover Destination Sub Directory Setup

    • RunTime Log Result:

    Limagito File Mover RunTime Log

    #FileTransfer

    If you need any info about this ‘Find in File text content’ question, please let us know.

    Best regards,

    Limagito Team

  • 01 Nov

    Create subfolders ahead with Limagito File Mover

    Q: We’re trying to create subfolders ahead with a rule in a following format: 2021\11 Nov21
    Is it possible to do this with an empty rule eg there’s no source file to move/copy? What would be the best way to handle this? Many thanks

    A: This is possible using our ‘Pascal Script’ as Source option. In this case no source files are needed.

    First add ‘Pascal Script’ as Source:

    Limagito File Mover Pascal Script as Source

    Add the following Pascal Script code.  Do not forget to adjust the ctPath const, end with a \

    Var
      tmpSubPath: String;
    Const
      ctPath = 'C:\Test\Out_PSC\';
    Begin
      psExitCode:= 1;
      // Create subfolders in the following format: 2021\11 Nov21
      tmpSubPath := FormatDateTime('YYYY\DD MMMYY', Now);
      If ForceDirectories(ctPath + tmpSubPath) then
        psLogWrite(1, '', 'Create Directory: ' + ctPath + tmpSubPath + ', Successful')
      Else
        psLogWrite(1, '', 'Create Directory: ' + ctPath + tmpSubPath + ', Error')
    End.

    Limagito File Mover Pascal Script Code example

    This script will create a single subfolder when it is triggered using the current date. Of course it can be modified so it fits your needs,  just let us know.

    Limagito File Mover RunTime Log

    Update, received the following question from user: Is there a way to add +1 to either month or date so I can adjust as required?

    1) To add a day, replace:  tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, Now);
    by
    tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, psIncDay(Now, 1));
    2) To add a month, replace: tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, Now);
    by
    tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, psIncMonth(Now, 1));

     

    #FileTransfer

    If you need any info about this ‘create subfolders ahead’ question, please let us know.

    Best regards,

    Limagito Team