File Mover Blog

August 4, 2022

Destination Folder Routing with Limagito File Mover

Q: Destination Folder Routing. I have a question about copying files to specific destinations depending on the name of the file. In the example filename below, depending on the file name, files should be copied to a specific folder. Specifically, if the file name has range “21181058” to “21181062” (bold part in the example filename) then it should go into Folder1. If the file name has range “21181022” to “21181037” then it should go to Folder2.

  • XYZ-21181058-123456789-001.xls

A: Yes, this is possible using some custome Pascal Script that we created for you. Some screenshots to get you started:

  • Open our Pascal Script option:

Limagito File Mover Pascal Script

  • Add and enable the following OnDestinations Pascal Script:
  tmpValue: Integer;
  tmpPart: String;
  psExitCode:= 0;
  // CRL-21181022-12022725-001
  tmpPart := Copy(psFileName, 5, 8);
  psLogWrite(0, '', 'Stripped from filename: ' + tmpPart);
  tmpValue := StrToIntDef(tmpPart, 0);
  If tmpValue = 0 Then
   psLogWrite(0, '', 'Stripped value from filename not correct: ' + tmpPart);
  // If the file name has range “21181058” to “21181062” than to Folder1.
  If (psDestinationID = 'ID1') Then
    If (tmpValue >= 21181058) And (tmpValue <= 21181062) Then 
      psExitCode := 1 
      psExitCode := -1; 
  // If the file name has range “21181022” to “21181037” than to Folder2.
  If (psDestinationID = 'ID2') Then 
    If (tmpValue >= 21181022) And (tmpValue <= 21181037) Then
      psExitCode := 1
      psExitCode := -1;
  // Out of Range
  If psExitCode = 0 Then
    psLogWrite(0, '', 'Stripped value from filename out of range: ' + tmpPart);

Limagito Fole Mover Pascal Script

  • Add your two destinations:

Limagito File Mover Destinations

  • RunTime Log Result:

Limagito File Mover Runtime Log

If you need any help with this ‘Destination Folder Routing’ option, please let us know.

Best Regards,

Limagito Team

#filetransfer #filemanagement