File Mover Blog

November 21, 2025

Send email when Number of files in a folder is higher than 10

Q: I would like to know how in Limagito to Send email when Number of files in a folder is higher than 10. So, count the number of *.xml files in a specific folder, and simply notify when the number is higher than 10.

A: Yes, this is possible using our scripting option

  • As Source we used our PScript option and added the following script:
    • Do not forget to adjust the Const values
      • ctSourcePath, ctFilter, ctIncludeSubDir and ctFileCount
    • Add the following script
      • If count of files > 10 than this will trigger the On Success Rule Event (psExitCode = 1)
Var
  tmpCount: Integer;
Const
  ctSourcePath = 'C:\Test\In_Xml\';
  ctFilter = '*.xml';
  ctIncludeSubDir = True;
  ctFileCount = 10;
Begin
  psExitCode:= 0;
  // ... add your code here
  tmpCount := psCountFiles(ctSourcePath, ctFilter, ctIncludeSubDir);
  If tmpCount > ctFileCount Then
  Begin
    psLogWrite(1, '', 'File Count: ' + IntToSTr(tmpCount) + ', more than ' + IntToStr(ctFileCount));
    psExitCode := 1;
  End;
End.

limagito file mover number of files in a folder

  • Next add the On Success Rule Event

limagito filemover on success rule event

  • Do not forget to enable the option ‘Enable On Success Events for LimagitoX temporary Files’.
    • This is needed because in this case we don’t have any Destination.

limagito file mover on success rule event options

  • Result email:

Send email when Number of files in a folder is higher than 10

If you need any help about this request, please let us know.

Best Regards,

Limagito Team

#managedfiletransfer #filetransfer #filemanagement

 

 

By Limagito-Team Pascal Script , Share:
SEARCH