• 11 Feb

    Lower case file rename using regular expression

    Q: We are having some trouble coming up with a proper reg-ex that will rename our files properly, and would like some advice.

    We are receiving files that are named as follows.

    ABCDE_ABC

    We would like to rename them to

    ABCDE_abc

    We have found several reg-ex commands that will do this, but none of them seem to work in the Limagito application. I am sure we have something wrong, but I am unable to find something that will give us the output that we want.

    Do you have any suggestions? Or perhaps an example string?

    Q: Yes this is possible using our File Rename option in your Destination setup:

    • Destination “File Rename” Setup

    Limagito File Mover Destination File Rename Setup

    > We are receiving files that are named as follows: ABCDE_ABC

    > We would like to rename them to ABCDE_abc

    We guess these file have a file extension so you could use:

    Lower Case File Rename RegEx

     

    #FileTransfer #RegEx

    If you need any info about this ‘lower case file rename ’ request, please let us know.

    Best regards,

    Limagito Team

  • 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
1 21 22 23 24 25 26
SEARCH