empty

  • 28 May

    Create an empty file named done.txt as all the files have been moved

    Q: We are using your software for some simple file moving automation. We find it very reliable and we would like to convert our existing CMD and ps scripts to Limagito rules. We have a script which performs the following steps:

    • Copy a directory and its contents from an FTP source only if the directory name matches a certain pattern (LQJ_yyyymmdd) > OK
    • Transfer the contents of the directory to an FTP destination in the folder /Replica/yyyymmdd/LQJ > OK
    • Create an empty file named done.txt as soon as all the files have been moved to the destination (step 2) in the FTP folder /Replica/yyymmdd

    Could you give me a hint about how to perform the last step?

    A: This is possible using some Pascal Script we created for you.

    Please open the Pascal Script setup:

    limagito file mover pascal script

    • Enable and Add the following ‘On Rule Begin’ Pascal Script. The result of psVSB will be used as parameter (%VSB) in the directory filter setup.
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSA := FormatDateTime('YYYYMMDD', Now);
      psVSB := '*_' + psVSA + ';' + '*\*_' + psVSA + '\*';
      //
      psLogWrite(1, '', psVSB);
    End.

    limagito file mover on rule begin pascal script

    • Enable and add the following ‘On Rule End’ Pascal Script. This script will create the Done.txt file ‘On Rule End’ when all files were transferred successfully. Don’t forget to adjust the ctDonePath ( must end with a \ ).
    Var
      tmpList: TStringList;
      tmpFile: String;
    Const
      ctDonePath = 'C:\Test\Pressor\Replica\';
    Begin
      psExitCode:= 0;
      tmpFile := ctDonePath + psVSA + '\Done.txt';
      // ... add your code here
      If (psCurrentFilesSrcError = 0) And (psCurrentFilesDstError = 0) Then
      Begin
        tmpList := TStringList.Create;
        Try
          tmpList.Text := 'Dummy Content';
          Try
            psCreatePath(ctDonePath + psVSA);
            tmpList.SaveToFile(tmpFile);
            // Debug
            psLogWrite(1, '', 'Save To File ' + tmpFile + ' Successful');
            // set ExitCode Successful
            psExitCode := 1;
          Except
            psLogWrite(1, '', 'Save To File ' + tmpFile + ' Error');
          End;
        Finally
          tmpList.Free;
        End;
      End
      Else
        psLogWrite(1, '', tmpFile + ' will not be created due to source or desitnation error(s)');
    End.

    limagito file mover on rule end pascal script

    • Directory setup, be sure to enable ‘Include Subdirectories’ and ‘Exclude Basedirectory’:

    limagito file mover directory setup

    • Set Dir Name include filter to:  %VSB

    The value of parameter %VSB will be set in the ‘On Rule Begin’ Pascal Script.

    limagit file mover directory name filter

    • Set Dir Name exclude filter to exclude certain unwanted subfolders:

    limagito file mover directory exclude filter

    • Be sure to allow the use of parameters in the Directory Name filter:

    limagito file mover directory filter

    • Destination setup:

    Limagito file mover destination setup

    limagito file mover win as destination

    limagito file mover windows folder as destination

    #filetransfer #mft #filemanagement

    If you need any info  about this ‘Create an empty file named done’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Filters Pascal Script ,
  • 16 May

    Q&A 10: Can we remove empty directories in LimagitoX File Mover

    Q: Can we create a rule which will remove empty directories once a week, not every scan?
    A: Yes this is possible. Let’s start with a new rule. Source will be the Windows folder you want to scan. Trigger it once a week and add a dummy Pascal Script as destination. Some screenshots to get you started.

    1.- Setup the Schedule.

    Disable the Scan Timers because we are going to use the Scheduler option instead.

    LimagitoX-Schedule-Disable-Scan-Timers

    Swith from Timer to Scheduler Tab and <Add> a Schedule. Change the setup of this schedule to once a week and <Save>.

    LimagitoX-Remove-Empty-Directories-Schedule

    2.- Set the File PreFix Filter to something impossible so it will never pickup files:

    LimagitoX-File-Prefix-Filter-Setup

    3.- Directory Filter Setup, enable ‘Include Subdirectories’ and ‘Delete Empty Subdirectories On Scan’:

    LimagitoX-Dir-Filter-Delete-Empty-Folders

    4.- Add a Dummy ‘Pascal Script’ as Destination:

    LimagitoX-Destination-Pascal-Script

    If you need help with ‘remove empty directories ‘, please let us know.

    Regards,

    Limagito Team

    By Limagito-Team Q&A , , ,
  • 07 May

    Q&A 8: Delete old files without deleting folders in Limagitox File Mover

    Q: I’m setting up a new rule to delete old files in a folder tree.  Easy to filter for files of a certain age (10 days old), but I’m concerned that folders would end up being deleted too.  Don’t see a way to tell the program not to touch the folders.

    A: As default we do not not delete folders. Only when you tell us to delete empty folders so be sure to disable the red marked option.

    Dir Filter Setup: be sure ‘Delete Empty Subdirectories’ is unchecked.

    LimagitoX-Delete-Empty-Folders

     

    If you need help, please let us know.

    Regards,

    Limagito Team

    By Limagito-Team Q&A ,
SEARCH