Filters

  • 01 Aug

    How to scan a folder to look for a number of files, then start the transfer?

    Q: How to scan a folder to look for a number of files, then start the transfer? We are a licensed customer of Limagito. Is it possible to scan a folder to look for 6 files, then start the transfer?  If there are less than 6 files, none of the files are transferred.

    A: This is possible with a Windows folder/Share [WIN] as Source. We added some screenshots to get you started.

    • Add Windows folder/share as Source:

    limagito file mover source setup

    •  Open our Pascal Script option:

    limagito file mover pascal script option

    • Please enable and add the following ‘On Rule Begin’ Pascal Script (script attached in txt file). You can modify the amount (ctMinFiles) or search filter (*.*) if needed.
    Var
      tmpCounter: Integer;
    Const
      ctMinFiles = 6;
    Begin
      psExitCode := 0;
      // ... add your code here
      // If you want to scan subirectories
      // tmpCounter := psCountFiles(psSourcePath, '*.*', True);
      // In this example we will not scan the subdirectories of the source folder
      tmpCounter := psCountFiles(psSourcePath, '*.*', False);
      If tmpCounter >= ctMinFiles Then
      Begin
        psLogWrite(1, '', 'Files count successful: ' + IntToStr(tmpCounter));     
        psExitCode := 1;
      End  
      Else
        psLogWrite(1, '', 'Not enough files, count: ' + IntToStr(tmpCounter));     
    End.

    limagito file mover look for a number of files

    • Click F9 and check the log window in the Pascal Script setup. It should show ‘Compiled Successfully’.

    limagito file mover pascal script compile result

     

    If you need any info about this ‘look for a number of files’ question, please let us know.

    Best regards,

    Limagito Team

  • 18 Jul

    How to move a folder tree and files when the subfolder matches my criteria

    Q: How to move a folder tree and files when the subfolder matches my criteria. I want to move a folder tree (with his files) from « home » only when the level 2 subfolder match “pour_ftv_editorial”.  The source is FTP and destination is Windows folder.

    Limagito  check the source folder « home »

    Limagito move in the destination folder « home_out »

    • SOURCE (FTP)

    limagito file mover move a folder tree

    • Destination (Windows Folder)

    limagito file mover move a folder tree

    A: This should be possible using the following “Directory filter”:

    • Enable “Include Subdirectories to allow us to scan the subfolders of your Source.
    • Enable “Exclude Basedirectory” because we don’t want to pickup files from the Root Source folder.

    limagito file mover subdirectory filter

    • As Include Directory name filter we will use: */pour_ftv_editorial/*

    limagito filemover directory filter

    limagito file mover directory filter

    Feedback user: “it works! Great”

    #mft #filetransfer #filemanagement

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

    Best regards,

    Limagito Team

    By Limagito-Team Filters
  • 28 May

    Create an empty file named done.txt as all the files have been moved

    Q: We are using your software for some simple file moving automation. We find it very reliable and we would like to convert our existing CMD and ps scripts to Limagito rules. We have a script which performs the following steps:

    • Copy a directory and its contents from an FTP source only if the directory name matches a certain pattern (LQJ_yyyymmdd) > OK
    • Transfer the contents of the directory to an FTP destination in the folder /Replica/yyyymmdd/LQJ > OK
    • Create an empty file named done.txt as soon as all the files have been moved to the destination (step 2) in the FTP folder /Replica/yyymmdd

    Could you give me a hint about how to perform the last step?

    A: This is possible using some Pascal Script we created for you.

    Please open the Pascal Script setup:

    limagito file mover pascal script

    • Enable and Add the following ‘On Rule Begin’ Pascal Script. The result of psVSB will be used as parameter (%VSB) in the directory filter setup.
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSA := FormatDateTime('YYYYMMDD', Now);
      psVSB := '*_' + psVSA + ';' + '*\*_' + psVSA + '\*';
      //
      psLogWrite(1, '', psVSB);
    End.

    limagito file mover on rule begin pascal script

    • Enable and add the following ‘On Rule End’ Pascal Script. This script will create the Done.txt file ‘On Rule End’ when all files were transferred successfully. Don’t forget to adjust the ctDonePath ( must end with a \ ).
    Var
      tmpList: TStringList;
      tmpFile: String;
    Const
      ctDonePath = 'C:\Test\Pressor\Replica\';
    Begin
      psExitCode:= 0;
      tmpFile := ctDonePath + psVSA + '\Done.txt';
      // ... add your code here
      If (psCurrentFilesSrcError = 0) And (psCurrentFilesDstError = 0) Then
      Begin
        tmpList := TStringList.Create;
        Try
          tmpList.Text := 'Dummy Content';
          Try
            psCreatePath(ctDonePath + psVSA);
            tmpList.SaveToFile(tmpFile);
            // Debug
            psLogWrite(1, '', 'Save To File ' + tmpFile + ' Successful');
            // set ExitCode Successful
            psExitCode := 1;
          Except
            psLogWrite(1, '', 'Save To File ' + tmpFile + ' Error');
          End;
        Finally
          tmpList.Free;
        End;
      End
      Else
        psLogWrite(1, '', tmpFile + ' will not be created due to source or desitnation error(s)');
    End.

    limagito file mover on rule end pascal script

    • Directory setup, be sure to enable ‘Include Subdirectories’ and ‘Exclude Basedirectory’:

    limagito file mover directory setup

    • Set Dir Name include filter to:  %VSB

    The value of parameter %VSB will be set in the ‘On Rule Begin’ Pascal Script.

    limagit file mover directory name filter

    • Set Dir Name exclude filter to exclude certain unwanted subfolders:

    limagito file mover directory exclude filter

    • Be sure to allow the use of parameters in the Directory Name filter:

    limagito file mover directory filter

    • Destination setup:

    Limagito file mover destination setup

    limagito file mover win as destination

    limagito file mover windows folder as destination

    #filetransfer #mft #filemanagement

    If you need any info  about this ‘Create an empty file named done’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Filters Pascal Script ,
1 3 4 5 6 7 8 9
SEARCH