File Mover Blog

  • 04 Oct

    How to move directories by sending an xml to a watch folder

    How to move directories by sending an xml to a watch folder

    Q: I want to move directories recusivly from one volume to another, by sending an xml to a watch folder.

    <Move>
    <Dir Src=”C:\Test\Label\In Dest=”C:\Test\Label\Out/>
    </Move>
    This moves all files and subdirectories from the source to destination, every time I drop a new file into the processing folder. Each xml will contain one entry (Src and Dest). When a xml file is successfully processed it should go to a ‘backup’ folder.
    A: Yes, this should be possible using our Pascal Script option. We’ll read the ‘Scr’ and ‘Dest’ value from the xml, the function and other settings need to be done within our File Mover. Both Src and Dest should be Windows folders or shares. We added an option that will move invalid xml files to an ‘error’ folder.
    • We used the following test folder structure:
    limagito file mover move directories by sending an xml
    • The Xml processing folder contains two subfolders:
      • Backup: when a xml file is successfully processed it should go to a ‘backup’ subfolder
      • Error: invalid xml files will be moved to this ‘error’ subfolder

    limagito file mover move directories by sending an xml

    • Source Setup:
      • Variable %VSA ( Variable String A ) will be set using our Pascal Script option

    limagito file mover windows folder as source

    • Destination Setup:
      • Variable %VSB ( Variable String B )will be set using our Pascal Script option

    limagito file mover windows folder as destination setup

    • Open our Pascal Script option:

    limagito filemover pascal script option

    • Enable and add the following ‘On Rule Begin’ Pascal Script:
      • You can download the script here
      • Do not forget to adjust the Const values
        • ctXmlPath: Path where we need to look for xml files
        • ctXmlErrorPath: Path where we will move invalid xml files to
        • ctRoot, ctChild, ctAttrSrc, ctAttrDest: Where do we need to look in the xml files to find ‘Src’ and ‘Dest’ values.

    limagito file mover on rule begin pascal script

    • Enable and add the following ‘On Rule End’ Pascal Script:
      • You can download the script here
      • Do not forget to adjust the Const values
        • ctXmlBackupPath: Path where successfully processed xml files are moved to

    limagito file mover on rule en pascal script

    • RunTime Log Result:
      • We found a valid ‘xml_processor.xml’ file containing ‘C:\Test\Label\In’ as Src and ‘C:\Test\Label\Out’ as Dest

    limagito file mover runtime log result

    If you need any help about this ‘move directories by sending an xml’ request, please let us know.

    Best Regards,

    Limagito Team

    #xml #managedfiletransfer #filetransfer #filemanagement

  • 28 Sep

    How to wrap any lines longer than say 80 characters

    How to wrap any lines longer than say 80 characters

    Q: Is there a way when moving a text file to wrap any lines longer than say 80 characters?

    A: Yes this possible using the following Pascal Script as Destination

    • Add our Pascal Script option in your Destination setup
      • Don’t forget to adjust the  ctOutputPath  Const value.

    limagito file mover wrap any lines longer than

    Var
      iList: Integer;
      tmpEntry, tmpStrip: String;
      tmpFileIn, tmpFileOut: String;
      tmpListIn, tmpListOut: TStringList;  
    Const
      // Should be different than the Source path, must end with a \
      ctWordWrap = 80;
      ctOutputPath = 'C:\Test\Out_TXT\'; 
    Begin
      psExitCode := 0;
      tmpFileIn := psFilePath + psFileName;
      tmpFileOut := ctOutputPath + psFileName;
      // ... add your code here
      tmpListIn := TStringList.Create;
      tmpListOut := TStringList.Create;
      Try
        Try
          tmpListIn.LoadFromFile(tmpFileIn);
          // Iterate
          For iList := 0 to (tmpListIn.Count-1) Do
          Begin
            tmpEntry := tmpListIn.Strings[iList];
            if Length(tmpEntry) > ctWordWrap Then
            Begin
              Repeat
                tmpStrip := Copy(tmpEntry, 1, ctWordWrap);   
                tmpListOut.Add(tmpStrip);
                tmpEntry := Copy(tmpEntry, ctWordWrap+1, length(tmpEntry)-ctWordWrap);
                If Length(tmpEntry) <= ctWordWrap Then
                  tmpListOut.Add(tmpEntry);   
              Until Length(tmpEntry) <= ctWordWrap;  
            End
            Else
              tmpListOut.Add(tmpEntry); 
          End;
        Except
          psLogWrite(1, '', 'Error handling ' + tmpFileIn); 
        End;
        // Save Result
        Try
          psLogWrite(1, '', 'Saving ' + tmpFileOut);
          tmpListOut.SaveToFile(tmpFileOut);
          // Set Result to Successful
          psExitCode := 1;
        Except
          psLogWrite(1, '', 'Error saving ' + tmpFileOut); 
        End;    
      Finally
        tmpListIn.Free;
        tmpListOut.Free;
      End;    
    End.
    

     

    If you need any help about this ‘wrap any lines longer than’ request, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

  • 21 Sep

    How to add additional files dynamically with smtp as destination

    How to add additional files dynamically with smtp as destination

    Q: I would need to send more than one selected file as attachments to a single mail-recipient. I haven’t managed to get it to work though. LimagitoX always send one mail per attachment. Are multiple attachments possible? It would be of considerable benefit to us, to be able to send multiple attachments. Would it be possible to add the discussed feature? We could be willing to contribute financially if that would persuade you.

    A: In version v2025.9.17.0 we added an option to add additional file(s) to SMTP as Destination. It is not exactly what you are asking but it could be used to achieve the same result.

    The following example will email all pdf files from a Source folder and when emailed successfully they will be deleted afterwards.

    • We used a Windows folder as Source:

    limagito file mover windows as source

    limagito file mover windows folder as source

    • Click <Schedule> > Advanced Tab > Set Max. Files processed in One Scan to 1
      • We just need one file from the source folder as a trigger to send the email

    limagito file mover schedule setup

    • Function Setup
      • Although the function is set to ‘Copy Files’ we’ll delete the source files using our Pascal Script option when the email was sent successfully
      • Select ‘Destination Memory & Exit Cyclus on Error’
        • This means that when the Second Destination fails (sending the email), then the third Destination will not be executed (deleting the Source files)

    limagito file mover function setup

    • Destination Setup:
      • First Destination: Pascal Script
      • Second Destination: SMTP
      • Third Destination: Pascal Script

    limagito file mover destination setup

      • First Destination: Pascal Script
        • Script available here: link
        • This Pascal Script will search for all pdf files from the Windows as Source folder
        • These files are added to a Pascal Script String Var:  %VSA

    limagito file mover pascal script as destination

      • Second Destination: SMTP

    limagito file mover additional files dynamically with smtp

        • Add the variable  %VSA  to the Additional field
          • Variable  %VSA  contains all pdf files found in the Windows Source folder
        • Disable ‘Include Source File as Attachment’ because this file is already included in the Additional  %VSA  variable

    limagito file mover additional files dynamically with smtp

      • Third Destination: Pascal Script
        • Script available here: link
        •  This Pascal Script will delete all pdf files from the Windows as Source folder when the email was sent successfully.

    limagito file mover pascal script as destination

    • RunTime Log Result:

    limagito file mover runtime log

    If you need any help about this ‘additional files dynamically with smtp’ option, please let us know.

    Best Regards,

    Limagito Team

    #smtp #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Email SMTP ,
1 2 3 4 5 162
SEARCH