ZIP

  • 06 Dec

    How to place zipped files back in their original folders

    How to place zipped files back in their original folders

    Q: Is there a way to place the zipped files back in their original folders? I just want to zip the folders and leave them in their original location. I need to ONLY zip the “ART” folder inside this subfolder. Maybe we could schedule a Remote support session to help me work through it?

    A: This should be possible using our scripting option.

    • As Source we need to add a Windows folder with the following setup:
      • Add %VSA as Source
      • %VSA is a parameter (Var String A) which will contain data from the script that we’ll add in a next step

    limagito file mover Windows folder as source setup

    • Open our Pascal Script option:

    limagito file mover pascal script option

    • Enable and add the following ‘On Rule Begin’ Pascal Script
      • Do not forget to adjust the ctSourceDir Const
      • The ctSoureDir is the directory you want us to scan for ‘Art’ subfolders.
    var
      iList: Integer;
      tmpList1, tmpList2: TStringList;
    Const
      ctSourceDir = 'C:\Test\In_ZIP';
    Begin
      psExitCode:= 0;
      psVSA := '';
      // ... add your code here
      tmpList1 := TStringList.Create;
      tmpList2 := TStringList.Create;
      Try
        tmpList2.StrictDelimiter := True;
        tmpList2.QuoteChar := #0;
        tmpList2.Delimiter := ';';
        psListPaths(ctSourceDir, '*.*', 1, tmpList1);
        For iList := 0 To (tmpList1.Count - 1) Do
        Begin
          psListPaths(tmpList1.Strings[iList], 'Art', 1, tmpList2);
        End;
        // Check
        If tmpList2.Count > 1 Then
        Begin
          psExitCode := 1;
          psVSA := tmpList2.DelimitedText;
          //
          psLogWriteStr('Source folders: ' + psVSA);
        End;
      Finally
        tmpList1.Free;
        tmpList2.Free;
      End;
    End.

    limagito file mover on rule begin pascal script

    • Folder structure of our ctSourceDir ( C:\Test\In_ZIP );

    limagito file mover test folder structure

    limagito file mover test folder structure

    limagito file mover test folder structure

    • Filename Exclude Filter Setup (optional):
      • We added *.zip as Filename Exclude Filter since we are placing the created zip file back in the directory which we are scanning for files, just to sure.

    limagito file mover exclude filename filter setup

    • Directory Filter Setup:

    limagito file mover directory filter setup

    • Function Setup:

    limagito file mover function setup

    • ZIP as Destination Setup:

    limagito file mover zip as destination setup

    • Zip as Destination Setup:
      • Zip all files found during scan to a single destination file
      • Adjust zip filename to Zipped-Art
      • Select ‘Add to archive if exists, otherwise create new archive’
      • Add .zip as extension

    limagito file mover zip as destination setup

    • Result after Rule is triggered:

    limagito file mover test folder setup

    If you need any help with this “place zipped files back” question, please let us know.

    Best Regards,

    Limagito Team

    #zip #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team ZIP
  • 30 Mar

    How to use 7z compression in Pascal Script

    How to use 7z compression in Pascal Script

    In version v2024.3.20.0 we added two new Pascal Script functions which allows you to use 7z compression.

    • Function ps7zCompress(Source: String; Destination: String; Password: String; Options: TStringList): Boolean;
    • Function ps7zCompressEx(Source: String; SourceFiles: TStringList; Destination: String; Password: String; Options: TStringList): Boolean;

    We added an example where we’ll be looking for a certain file called ‘trigger.txt’ within subfolders. If this trigger file is found we’ll compress the complete subfolder. The goal is to create a compressed backup of the complete subfolder content.

    • As Source we used a Windows Folder:

    limagito file mover windows folder as source

    • The content of subfolder ‘Sub’ looks like the following screenshot. It contains the ‘trigger.txt’ file which we’ll use to start the compressing mechanism.

    limagito file mover windows folder as source

    • We added the following include filename filter, because we are searching for the ‘trigger.txt’ only. This file will determine which subfolder we need to compress.

    limagito filemover filename include filter

    • Enable ‘Include Subdirectories’ within the Dir Filter’ setup:

    limagito filemover directory filter

    • We enable our ‘File Memory’ option because we only want to compress its subfolder once. If the trigger.txt is changed, then we’ll compress the subfolder again.

    limagito file mover file memory option

    – Function is set to ‘Copy’ because we want to keep the source files.

    limagito file mover function setup

    • Now add our ‘Pascal Script’ as Destination:
      • Please add the following script: link
      • Please adjust the following Const if needed:
        • ctZipPassword
        • ctZipExt
        • ctOutputPath

    7z compression in Pascal Script

    • The new ps7zCompress function has quite some options available which you can adjust if needed:
      • AddDirectory = False, True (default: True)
      • CompressionMethod = Copy, Deflate, Deflate64, BZip2, LZMA, LZMA2, PPMd (default: Deflate)
      • DuplicateCheck = None, Existing, All (default: Existing)
      • DuplicateAction = Overwrite, Error, Skip (default: Overwrite)
      • EncryptionMethod = None, AES128, AES192, AES256, ZipCrypto (default: ZipCrypto)
      • FileIncludeFilter = (default: *.*)
      • ScanSubDirectories = False, True (default: True)
      • Level = 0..9 (default: 7)
      • Threads = 1 .. 255 (default: 1)
      • Error = ‘Error Description if compression fails’

    7z compression in Pascal Script

    • RunTime Log Result:

    limagito filemover runtime log

    • Output Result:

    7z compression in Pascal Script

    If you need any help with our new ‘7z compression in Pascal Script’ feature, please let us know.

    Best Regards,

    Limagito Team

    #7z #pascalscript #managedfiletransfer #FileManagement #filetransfer

    By Limagito-Team Pascal Script ZIP ,
  • 27 Dec

    Unzip stream read error with Limagito File Mover

    Unzip Stream Read Error

    Q: We are having an issue with one of our rules. We are getting a couple of errors:

    limagito file mover stream read error

    A: We asked and received a test file. The reason of these errors was simple .. it wasn’t a zip file. The file had the extension .zip but it should have been .7z (= SevenZip compression) which is a different compression method. We use the extension in our file mover tool to determine which kind compression is used in the Source file.

    We added the following option: UNZIP as Destination, Use Archive Header to determine Format (v2023.11.21.0) [+]

    We asked the customer if we could help with the update, otherwise he could use: https://limagito.com/how-to-update-your-current-version-of-limagitox-file-mover/
    After the update we asked to enable ‘Use Archive Header to determine Format’ in the Unzip as Destination setup. In this case we’ll check the header of the file and try to recognize the compression format. If we don’t recognize the header we’ll use the file extension.
    limagito file mover unzip options
    Important, this option only works with ‘API Vendor 3 – 7z’
    limagito file mover unzip options
    It looks like that works! Thank you for your help!

    #zip #unzip #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘unzip stream read error’ question, please let us know.

    Best Regards,

    Limagito Team

     

    By Limagito-Team ZIP
1 2 3 4
SEARCH