File Mover Blog

August 1, 2023

How to scan a folder to look for a number of files, then start the transfer?

Q: How to scan a folder to look for a number of files, then start the transfer? We are a licensed customer of Limagito. Is it possible to scan a folder to look for 6 files, then start the transfer?  If there are less than 6 files, none of the files are transferred.

A: This is possible with a Windows folder/Share [WIN] as Source. We added some screenshots to get you started.

  • Add Windows folder/share as Source:

limagito file mover source setup

  •  Open our Pascal Script option:

limagito file mover pascal script option

  • Please enable and add the following ‘On Rule Begin’ Pascal Script (script attached in txt file). You can modify the amount (ctMinFiles) or search filter (*.*) if needed.
Var
  tmpCounter: Integer;
Const
  ctMinFiles = 6;
Begin
  psExitCode := 0;
  // ... add your code here
  // If you want to scan subirectories
  // tmpCounter := psCountFiles(psSourcePath, '*.*', True);
  // In this example we will not scan the subdirectories of the source folder
  tmpCounter := psCountFiles(psSourcePath, '*.*', False);
  If tmpCounter >= ctMinFiles Then
  Begin
    psLogWrite(1, '', 'Files count successful: ' + IntToStr(tmpCounter));     
    psExitCode := 1;
  End  
  Else
    psLogWrite(1, '', 'Not enough files, count: ' + IntToStr(tmpCounter));     
End.

limagito file mover look for a number of files

  • Click F9 and check the log window in the Pascal Script setup. It should show ‘Compiled Successfully’.

limagito file mover pascal script compile result

 

If you need any info about this ‘look for a number of files’ question, please let us know.

Best regards,

Limagito Team

By Limagito-Team Filters Pascal Script WIN Share:
SEARCH