ZIP

  • 28 May

    Delete all contents of a destination folder before files are moved

    Q: Is there a way to delete all contents of a destination folder before files are moved/not just overwriting them? I am unzipping a large folder with files daily, most files are named the same thing so they can overwrite them. Have a few that are named with dates and times so they just end up staying in the folder.

    A: If the unzip folder is always the same, the following solution could help you. We added a script that will delete all files and subfolders when ‘On Rule Begin’ is triggered. The path you need to use in the script is the one you will use in your UNZIP as Destination setup.

    – Open Pascal Script Setup

    limagito file mover pascal script

    • Enable and Add the following ‘On Rule Begin’ Pascal Script. In this example our Unzip path = C:\Test\Out\UNZIP\

    Don’t forget to adjust the ctOutputPath const, must end with a \

    Const
      ctOutputPath = 'C:\Test\Out\UNZIP\';
    Begin
      psExitCode:= 1;
      // ... add your code here
      psLogWrite(1, '', 'Delete Tree: ' + ctOutputPath);
      psDeleteFiles(ctOutputPath, '*.*');
      psDeleteTree(ctOutputPath, True);
    End.

    Delete all contents of a destination

    #filetransfer #mft #filemanagement

    If you need any info  about this ‘Delete all contents of a destination’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script WIN ZIP ,
  • 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 ,
  • 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

1 2 3 4
SEARCH