WIN

  • 14 Nov

    I want to be able to Find in File text content. Is this possible ?

    Q: I want to be able to Find in File text content. Is this possible? For example, if the file contain a string in the file content, than do an operation. Is it possible in Limagito or we can only do something with the file name?

    In attachment, you will find folders and files example.

    –          If we find the string ST^832^ then we need to move the file in the folder « Price »

    –          If we find the string ST^810^ then we need to move the file in the folder « Invoice »

    So, the process should do this :

    –          Move the files !EDIFile.Exaple1 and !EDIFile.Example2 in folder « Price »

    –          Move the file ASSET.Example in folder « Invoice »

    A: Yes this is possible using a custom script which we create for you. I’ve added some screenshots to help you.

    • Source is a Windows folder:

    Limagito File Mover Windows Folder as Source

    • Open ‘Pascal Script’ Setup:

    Limagito File Mover Pascal Script option

    • Enable and add the following ‘On Destination’ Pascal Script:
    Var
      tmpFile: String;
      tmpList: TStringList;
    Const
      ctInvoiceSearch = 'ST^810^';
      ctPriceSearch = 'ST^832^';
      ctInvoiceSubDir = 'Invoice';
      ctPriceSubDir = 'Price';
    Begin
      psVSA := '';
      psExitCode:= 0;
      // ... add your code here
      tmpFile := psFilePath + psFileName;
      tmpList := TStringList.Create;
      Try
        Try
          tmpList.LoadFromFile(tmpFile);
          // Check Invoice
          If pos(ctInvoiceSearch, tmpList.Text) <> 0 Then
          Begin
            psVSA := ctInvoiceSubDir;
            psExitCode := 1;
            psLogWrite(1, '', 'Destination SubDir: ' + ctInvoiceSubDir + ' for ' +tmpFile);
          End;
          // Check Price
          If pos(ctPriceSearch, tmpList.Text) <> 0 Then
          Begin
            psVSA := ctPriceSubDir;
            psExitCode := 1;
            psLogWrite(1, '', 'Destination SubDir: ' + ctPriceSubDir + ' for ' + tmpFile);
          End;
          // Nothing was Found
          If psVSA = '' Then
          Begin
            psLogWrite(1, '', 'Destination SubDir Unknown for ' + tmpFile);
          End;
        Except
          psLogWrite(1, '', 'Error loading ' + tmpFile);
        End;
      Finally
        tmpList.Free;
      End;
    End.

    Limagito File Mover On Destination Pascal Script

    • Set Function to ‘Move Files’:

    Limagito File Mover Function Setup

    • Add ‘WIN’ as Destination

    Limagito File Mover Destination Selection

    • Select your Destination Directory:

    Limagito File Mover WIN as Destination Setup

    • Adjust the default ‘Create Subdir, option’ to:  %VSA\%SFS

    The reason you need to change this is because we’ want to use information from the previous Pascal Script to select the correct Subdirectory. In this example it will be ‘Price’ or ‘Invoice’.

    Limagito File Mover Destination Sub Directory Setup

    • RunTime Log Result:

    Limagito File Mover RunTime Log

    #FileTransfer

    If you need any info about this ‘Find in File text content’ question, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script WIN , ,
  • 01 Oct

    Immediate folder name as filename in Limagito File Mover

    Q: I am trying to append a folder name to a file name but having a little trouble. The file is under 1 or 2 subfolder. After the file move I would like to append the very last folder name to the file name , and I don’t want to copy the source folder structure. Can you help me.

    Limagito File Mover Subfolder Filename

    A: Yes this is possible using some Pascal Script. We’ll need two destinations.

    • The first destination must be our ‘Pascal Script’. This script will strip the immediate subfolder from the complete subfolder part.
    • The second destination will be a Windows folder (WIN). In this destination we’ll rename the file using the info from the first destination (pascal script).

    Limagito File Mover Destination Setup

    Let’s start with the first destination (Pascal Script):

    Var
      iList: Integer;
      tmpEntry: String;
      tmpList: TStringList;
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSA := Trim(psStringReplace(psFilePath, psSourcePath, ''));
      If psVSA <> '' Then
      Begin
        tmpList := TStringList.Create;
        Try
          tmpList.Delimiter := '\';
          tmpList.DelimitedText := psVSA;
          psVSA := '';
          // Iterate
          For iList := (tmpList.Count - 1) DownTo 0 Do
          Begin
            tmpEntry := Trim(tmpList.Strings[iList]);
            If tmpEntry <> '' Then
            Begin
              psVSA := tmpEntry;
              Break;
            End;
          End;
        Finally
          tmpList.Free;
        End;
      End;
      // Adjust
      If psVSA <> '' Then
        psVSA := psVSA + '_';
      // Debug
      psLogWrite(1, '', 'Stripped SubFolder: ' + psVSA);
    End.

    Limagito File Mover Pascal Script Setup

    Next we’ll setup our second destination (WIN):

    Limagito File Mover WIN as Destination

    Don’t forget to disable the ‘Create SubDir’ option if you don’t want to copy the source folder structure.

    Limgito File Mover Create Subfolder option

    File renaming setup:

    Limagito File Mover File Rename

    RegEx: (.*)

    Replacement: %VSA\1

    Limagito File Mover File Rename Setup

    RunTime Log:

    Limagito File Mover RunTime Log

    #FileTransfer

    If you need any info about this ‘Immediate folder name as filename’ question, please let us know.

    Best regards,

    Limagito Team

  • 19 Aug

    Change time date stamp to the time and date that files are moved

    Q: Is it possible, while moving a file, to also change the time date stamp to the time and date that the files are moved? I’m trying to set up a rule to remove certain files from a folder and just want to change the time and date of the file to the time that the file was moved by this rule.

    A: Yes this is possible. Please open your Destination setup and select ‘File & Directory’ Tab.

    Please enable our ‘Reset File DateTime to Current DateTime’ option.

    Limagito File Mover Timestamp

    Feedback user: “Works great. Thank you”

    #FileTransfer

    If you need any info about this ‘Change time date stamp’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team WIN , ,
1 3 4 5 6 7 8 9
SEARCH