File Mover Blog

  • 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

    By Limagito-Team Pascal Script ,
  • 31 Oct

    Corrupted TAR file, error management during unzip

    Q: Error management during unzip request.

    We received a broken package (TAR file) in a folder processed by Limagito. The rule is to unpack any zip or tar file arriving in that folder and then move the zip or tar file.
    But for the broken package “example.tar” the file remains in the folder and is processed again and again.

    22/10/2021 14:51:47 Execute: ID1[ZIP]\\nas\Media\Work\FilesUnpack\
    22/10/2021 14:51:47 7z Item Count of \\nas\Media\Work\example.tar: 4
    22/10/2021 14:51:47 7z Item 1, File: \\nas\Media\Work\FilesUnpack\.\example1.jpg
    22/10/2021 14:51:47 7z Item 2, File: \\nas\Media\Work\FilesUnpack\.\example2.jpg
    22/10/2021 14:51:47 7z Item 3, File: \\nas\Media\Work\FilesUnpack\.\example.mpg
    22/10/2021 14:52:19 7z Extract Selected Exception: Data error
    22/10/2021 14:52:19 UNZIP Error \\nas\Media\Work\example.tar to \\nas\Media\Work\FilesUnpack\;3560701952

    The file is not moved. The process never ends. I configure the error notification by mail. And this works. What would be your advice to manage this?
    EX: move the file in error in another folder.

    A: In version v2021.10.30.0 we added a Pascal Script var to achieve your request. psDeleteAfterCopy which is an integer can only be used in the Destination Pascal Script (0 = error occurred, we will not delete the Source file).

    Some screenshots to get you started. We assume the Source (WIN, scanning compressed files) and Destination (UNZIP) part is already setup in our File Mover. So to add error management to this setup you’ll have to add ‘Pascal Script’ as second Destination. Important, the Pascal Script must come after the UNZIP.

    Limagito File Mover Destination Setup

    Add the following Pascal Script code, do not forget to adjust the crErrorPath constant, it must end with \ :

    Const
      ctErrorPath = 'C:\Test\Error\';
    Begin
      psExitCode:= 1;
      // ... add your code here
      If psDeleteAfterCopy = 0 Then
      begin
        If psMoveFile(psFilePath + psFileName, ctErrorPath + psFileName) Then
          psLogWrite(1, '', 'Moved ' + psFilePath + psFileName + ' to ' + ctErrorPath)
        Else
          psLogWrite(1, '', 'Move Error of ' + psFilePath + psFileName + ' to ' + ctErrorPath);
      End;
    End.
    

    Limagito File Mover Pascal Script as Destination

    In case of error the source file will be moved to the ctErrorPath, in our case it is: C:\Test\Error\

    Limagito File Mover RunTime Log

    #FileTransfer

    If you need any info about this ‘error management during unzip’ question, please let us know.

    Best regards,

    Limagito Team

  • 13 Oct

    Limagito SFTP Server Public Key Authentication

    Q: SFTP Server Public Key Authentication. Quick question regarding limagito and it’s SFTP server. Is it possible to configure an ssh key instead of using user / password?
    A: In version v2021.10.13 we added the possibility to use Public Key authentication with our SFTP server.

    We used PuTTY Key Generator to create a Public and Private key file. Click the ‘Generate’ button and move your mouse around. Afterwards we added a passphrase and saved the public and private key to a file.

    Limagito File Mover Putty SSH Keys

    Saved .ppk files:

    Limagito File Mover Putty SSH Key files

    Next open the SFTP Server Setup and select the ‘Accounts’ tab. Choose the User Account which you want to add the Public Key file to. Select the Public Key File and do not forget to click the ‘Save’ button of the ‘User Account Setup’ (at the top).

    Limagito SFTP Server Public Key Authentication

    Click ‘Save’ button at the bottom to close the SFTP Server Setup

    If you want to be sure that the Publice Key file was loaded correctly then you please check the SFTP server Log.

    To enable logging of the SFTP Server (Logging Tab):

    Limagito SFTP server Logging

    We used the default log folder. It is never ever a good idea to put a log file on a network share, please always use a local drive.

    Limagito File Mover Logging

    SFTP Server log content, search for ‘Public Key’. In our case no loading error, so we are good to go.

    Limagito SFTP Server log content

    We tested the Public Key Authentication using our own File Mover. Be sure to select our second API Vendor: Vendor 2 – CK.

    Limagito File Mover SFTP Setup

    Select the ‘Security’ Tab and add your Private Key File and Private Key Password (only if you added a password/passphrase to this file).

    Limagito File Mover SFTP Private Key File

    Previous information about our SFTP server option: Limagito SFTP Server

    #FileTransfer #SFTP

    If you need any info about the ‘SFTP Server Public Key Authentication’ option, please let us know.

    Best regards,

    Limagito Team

1 63 64 65 66 67 68 69 145
SEARCH