File Mover Blog

  • 10 Feb

    Move and change content of a txt-file

    Q: Hello Limagito, Now I need your help again…

    I got a TXT-file delivered from my customer with approximately 250 rows.

    In the txt file I like “search and replace” a text string :

    ;19;18;;

    Should be replaced with

    ;36;35;;

    And the string

    ;21;21;;

    Should be replaced with

    ;37;37;;

    I also tried to set the powershell exe file in the field for Application name (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)

    Is there any other way?

    A: Yes there is, we can do this easily with our Pascal Script so no need for external scripts if you want.

    In our example we’ll use a Windows folder as Source:

    Limagito File Mover WIN as Source

    We only want to handle .txt file so we added the following Filename Include Filter:

    Limagito File Mover Include Filename Filter

    As Destination we added a Pascal Script. This script will does the work you requested.

    Limagito File Mover Pascal Script as Destination

    • Adjust ctOutputPath > must end with a \
    • Encoding of destination text file can be adjusted

     

    Var
      tmpFileIn, tmpFileOut: String;
      tmpList: TStringList;
    Const
      ctOutputPath = 'C:\Test\Out_Txt\';
    Begin
      // Init var
      psExitCode:= 0;
      tmpFileIn := psFilePath + psFileName;
      tmpFileOut := ctOutputPath + psFileName; 
      // ... add your code here
      tmpList := TStringList.Create;
      Try
        Try
          tmpList.LoadFromFile(tmpFileIn);
          tmpList.Text := psStringReplace(tmpList.Text, ';19;18;;', ';36;35;;');
          tmpList.Text := psStringReplace(tmpList.Text, ';21;21;;', ';37;37;;');
          // https://docs.microsoft.com/nl-be/windows/win32/intl/code-page-identifiers
          If psSaveTxt2File(tmpList.Text, ctOutputPath + psFileName, 'ISO-8859-1', False) Then
          Begin
            psExitCode := 1;
            psLogWrite(1, '', 'SaveToFile ' + tmpFileOut + ' Successful');    
          End
          Else
            psLogWrite(1, '', 'SaveToFile ' + tmpFileOut + ' Error');
        Except
          psLogWrite(1, '', 'LoadFromFile ' + tmpFileIn + ' Exception');
        End;
      Finally
        tmpList.Free;
      End;  
    End.
    

    Limagito File Mover Pascal Script as Destination

    Feedback Customer:

    As always you save the day! The Pascal script did my work easily. Some day I have to learn more about pascal!

    I cheat some in powershell and some visual basic, but this stuff is powerful!

    By the way, it only worked in the newer version of Limagito (I still have some workflows in the old version)

    Thank you for help, quick and accurate, as always!

    #FileTransfer #Encoding

    If you need any info about this ‘change content of a txt-file’ request, please let us know.

    Best regards,

    Limagito Team

  • 09 Feb

    Error code 1265 when Trying to run rules on remote devices via DNS name

    Q: I am having the following error:

    Exception: Error trying to create file handle for ‘example of filename with DNS Source Path’ Error code 1265

    There is no error when using the IP address, but we use rotating ip addresses so that is not a viable solution, could you help me troubleshoot this?

    Error Code 1265

    A: Error codes when using WIN as Source or Destination are Operating System Errors. We are using the same function and procedures as the Windows File Explorer does. This is the first time we received feedback of error code 1265. A Google search returns over 5.000.000 hits.

    Although the ‘Logon As’ user of the Limagito Service was set correctly we could not search in this folder. It did not show any subfolders or files using our ‘Explorer’ in the WIN as Source setup screen.

    Error Code 1265

    We solved the issue by adding the Source Path and an appropriate User Account in our Network Drive option.

    Tools Menu Time > Network Drive

    Network Drive Setup

    #FileTransfer #1265

    If you need any info about this ‘Error Code 1265’, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team WIN
  • 31 Jan

    AWS S3 MD5 digest with multipart uploads

    AWS S3 MD5 digest with multipart uploads

    In version v2023.1.31.0 we added Verify support for multipart uploads. Some very interesting information can be found here:

    So ..

    1. If an object is created by a Multipart Upload operation, the ETag is not an MD5 digest, regardless of the method of encryption.
    2. For multipart uploads the ETag is the MD5 hexdigest of each part’s MD5 digest concatenated together, followed by the number of parts separated by a dash.

    We added code to recalculate the MD5 hex digest using the Filesize of the download and the ETag ‘stripped number of parts’ we received from the S3 object. This way we could calculate the size and MD5 checksum for each part. This information was used to calculate the MD5 hex digest of the concatenated checksums.

    By default ‘Verify File after Copy / Move’ is enabled which uses the ETag of the S3 object (File) as MD5 hash to compare the download result.

    Limagito File Mover AWS S3 MD5 digest

    #FileTransfer #awss3

    If you need any info about this ‘AWS S3 compatible storage providers’ option, please let us know.

    Best regards,

    Limagito Team

     

    By Limagito-Team AWS S3
1 29 30 31 32 33 34 35 135
SEARCH