File Mover Blog

  • 15 Oct

    Q&A 26: Custom SMTP report with filename and transfer timestamp

    Q: Custom SMTP report. I am trying to set up SMTP notifications / Reports that will be sent out once a job runs. I am having the following trouble, I want the email to show the filename and timestamp of when it was transferred, I have this working but if there is multiple files it will send multiple emails, I want a single email per Rule that will one send out one email with file names and time each file was moved.
    A: We’ve added some screenshots to get you started.

    >Please open ‘Rule Events’ Setup in the ‘Moving Rule’ Menu:

    LimagitoX File Mover Rule Events

    >Select and enable ‘On Rule Begin’ event item. Within the ‘On Rule Begin’ event item:

    • Select Pascal Script tab and enable ‘Enable Pascal Script’.
    • Add the following Pascal Script:
    Begin
      // ... add your code here
      psVSA := '';
    End.
    

    LimagitoX File Mover Rule Events Setup

    >Select and enable ‘On Success’ event item. Within the ‘On Success’ event item:

    • Select ‘Options’ tab and enable ‘Trigger mail event after scan’.
    • Optionally you can enable ‘Enable On Success Events for LimagitoX Temporary Files’.

    • Select ‘Pascal Script’ Tab and enable ‘Enable Pascal Script’.
    • Add the following Pascal Script:
    var
      tmpList: TStringList;
      tmpTime: String;
    Begin
      // ... add your code here
      tmpList := TStringList.Create;
      Try
        // Read from psVSA
        tmpList.Text := psVSA;
        // Add To psVSA
        tmpTime := FormatDateTime('YYYY/MM/DD HH:NN:SS', Now);
        tmpList.Add(psFilePath + psFilename + ' @ ' + tmpTime);
        // Write to psVSA
        psVSA := tmpList.Text; 
      Finally
        tmpList.Free;
      End;  
    End.
    

    • Select ‘Email’ tab and enable ‘Enable Mail’
    • Setup SMTP server and Email itself. There is a test button available.

    • Important, in the mail body you’ll need to add:  %VSA
      • This %VSA will contain the file information added thanks to the previous Pascal Script

    • We used the gmail smtp server in this example but any other smtp server will work.

    >Result

    If you need any help with this custom SMTP report, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Q&A SMTP
  • 04 Oct

    Weather reading using REST API in LimagitoX File Mover

    Weather reading using REST API in LimagitoX File Mover

    In this example we’ll show you how to get weather information as JSON using a REST API call.

    >Select REST as Source:
    LimagitoX File Mover REST as Source

    >REST as Source Setup:

    We’ll use an API from openweathermap.org

    https://api.openweathermap.org/data/2.5/weather?appid={openweathermap_apikey}&q=chicago

    More information here.

    LimagitoX File Mover REST Setup

    >Select WIN as Destination:

    LimagitoX File Mover WIN as Destination

    >RunTime Log Result

    LimagitoX File Mover RunTime Log Rest Result

    >Destination File

    LimagitoX File Mover REST destination file

    >Content Destination File opened using Notepad++

    >Content Destination File opened in Notepad++ and its JSON Plugin

    The next step could be a conversion from JSON to another format, many options are possible. This is just an example to show you what can be done with REST as Source in LimagitoX File Mover.

     

    If you need any help with this REST Weather reading API Call setup, please let us know.

    Best Regards,

    Limagito Team

     

    >> Notepad++ Hint, installing the JSON Plugin <<

     

    By Limagito-Team REST
  • 03 Oct

    Looking for a File Mover Software to accomplish Archiving task

    Q: Looking for Software to accomplish Archiving task.

    Details: Looking for product that we can schedule to look at multiple project folders within a base directory, if no files have been modified in X days within a project folder, then move (copy/delete) that whole project directory and files to another server/CIFS location. Even better if that product can append a string (like date) to the moved project folder for reference ( if possible append 10_02_2020 to end of projectX folder name). Essentially we want to automate archiving data from expensive location/storage to cheap location/storage.

    A: In version v2020.10.3.0 we added some Pascal Script functions to achieve this request.

    What we will do is:
    – Scan base directory for project folders (1 level deep) using Pascal Script
    – Scan each project folder we found for the youngest filedate
    – If youngest filedate in this folder is older than x days then we add this folder to a parameter (%VSA)
    – At the end we provide this parameter (%VSA) as WIN Source. This parameter can containe multiple project folders.
    – The renaming of the Destination will be done in the WIN Destination Setup with a little help of Pascal Script

    Some screenshots to get you started:

    >Please Select WIN as Source and change the ‘Select Directory’ to %VSA.

    So as you see the WIN as Source will NOT be your project base folder! Parameters in LimagitoX File Mover start with %. %VSA stands for Variable String A. %VSA can be used at different places in the rule setup. In this case %VSA will get its value using Pascal Script.


    LimagitoX File Mover WIN as Source

    > Select ‘Pascal Script’ Setup in the ‘Moving Rule’ menu:

    LimagitoX Pascal Script

    >Enable and add the following ‘On Rule Begin’ Pascal Script:

    Important, change the following Const in the Pascal Script:

    • ctSourcePath = ‘C:\Test\In\’;
    • ctOlderThanInDays = 1000;

    ctSourcePath is the base directory of your Project Folders.

    ctOlderThanInDays is set to 1000. So in this case the youngest file should be older then 1000 days before we move the project folder and its content.

    Var
      iPath: Integer;
      tmpFileDate: TDateTime;
      tmpFileName: String;
      tmpPath: String;
      tmpPaths: TStringList;
    Const
      ctSourcePath = 'C:\Test\In\';
      ctOlderThanInDays = 1000;
    Begin
      // Init Var
      psExitCode:= 0;
      psVSA := '';
      // ... add your code here
      psLogWrite(1, '', 'PS Source File Path: ' + ctSourcePath);
      tmpPaths := TStringList.Create;
      Try
        // psListPaths(Directory: String; DirectoryFilter: String; DirectoryLevel: integer; Var Paths: TStringList);
        psListPaths(ctSourcePath, '*', 1, tmpPaths);
        psLogWrite(1, '', 'PS Folders Found: ' + tmpPaths.Text);
        // Iterate
        For iPath := 0 To (tmpPaths.Count-1) Do
        Begin
          tmpPath := tmpPaths.Strings[iPath];
          // psGetYoungestFilename(Directory: String; FilenameFilter: String; IncludeSubDirectory: boolean): String;
          tmpFileDate := psGetYoungestFileDate(tmpPath, '*.*', True);
          If tmpFileDate <> 0 Then
          Begin
            // Debug Info
            tmpFileName := psGetYoungestFilename(tmpPath, '*.*', True);
            psLogWrite(1, '', 'PS Youngest Filename Found: ' + tmpFileName + ' in ' + tmpPath);
            // Check Date
            If tmpFileDate < (Now - ctOlderThanInDays) Then
            Begin
              // Add Patht to psVSA Param
              If psVSA = '' Then
                psVSA := tmpPath + ';'
              Else
                psVSA := psVSA + tmpPath + ';';
            End;
          End;
        End;
        // Debug Info
        psLogWrite(1, '', 'PS Path Count: ' + IntToStr(tmpPaths.Count));
      Finally
        tmpPaths.Free;
      End;
      // Check Result
      If psVSA <> '' Then
      Begin
        psLogWrite(1, '', 'Pascal Script psVSA Result: ' + psVSA);
        psExitCode := 1;
      End
      Else
        psVSA := 'C:\NonExistingPath\';
    End.
    

    >Enable and add the following ‘On Destination’ Pascal Script

    Important, change the following Const in the Pascal Script:

    • ctSourcePath = ‘C:\Test\In\’;

    ctSourcePath is the base directory of your Project Folders. Must be exactly the same as in the previous ‘On Rule Begin’ Pascal Script.

    This Pascal Script will strip the root part of the Project Folder and set it to %VSB. We’ll use %VSB later for adding the date as requested to the root folder of the project.

    LimagitoX Pascal Script On Destination

    Const
      ctSourcePath = 'C:\Test\In\';
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSB := psStringReplace(psSourcePath, ctSourcePath, '');
      psVSB := psStringReplace(psVSB, '\', '');
      psLogWrite(1, '', 'psVSB: ' + psVSB);
    End.
    

    >Select ‘Add WIN’ in the Destination Setup:

    LimagitoX File Mover Select Destination

    >Select your Destination folder (= where to move the project folders to):

    LimagitoX File Mover WIN as Destination

    >Enable and set ‘Create Subdir, opt.’ to:  %VSB_%TCD:MM_DD_YYYY:\%SFS

    LimagitoX File Mover Subdir option

    > Function setup, please leave the Function to ‘Copy Files’ during your tests. If everything is ok then you can change it to ‘Move Files’.

    LimagitoX File Mover Function Setup

    > Done

    If you need any help with this Archiving task setup, please let us know.

    Best Regards,

    Limagito Team

1 73 74 75 76 77 78 79 135
SEARCH