Filters

  • 04 Sep

    How to when files arrive, copy files from an other source directory

    How to when files arrive, copy files from an other source directory

    Q: I need some help on a Limagito rule I need to write :

    • Check files into a source directory.
    • When these files arrive, copy files from an other source directory with same filename but different extension.

    ie :

    Check files named 123456.pregen from c:\Test\Search\

    Then copy file c:\Test\In\123456.pdf to c:\dest\

    A: Please have a look at the following screenshots:

    • We are using a Windows folder as source. The goal is to copy files from here to a destination. Which files will depend on the script we are going to add.

    limagito file mover windows folder as source

    • File Filter Setup:
      • Add  %VSA  as include Filename Filter (%VSA = Variable String A)
      • The %VSA will contain the filenames we want to copy. Our Pascal script will add the filenames to this Var.

    limagito file mover file filter setup

    • Enable ‘Allow parameters in File Name filter’ (File Filter Setup – Advanced Tab):

    limagito file mover file filter advanced setup

    • Open our Pascal Script option

    limagito file mover pascal script option

    • Add and enable the following ‘On Rule Begin’ Pascal Script:
      • Do not forget to adjust the CtSearchPath (ctSearchFilter and ctSearchSubFolders) Const

     

    Var
      iList: Integer;
      tmpFilename: String;
      tmpList: TstringList;
    Const
      ctSearchPath = 'C:\Test\Search\'; // Must end with a \
      ctSearchFilter = '*.pregen';
      ctSearchSubFolders = False; // False or True
    Begin
      psExitCode:= 0;
      psVSA := '';
      // ... add your code here
      tmpList := psListFiles(ctSearchPath, ctSearchFilter, ctSearchSubFolders);
      Try
        For iList := 0 to (tmpList.Count-1) Do
        Begin
          tmpFilename := tmpList.Strings[iList];
          tmpFilename := ChangeFileExt(tmpFilename, '.pdf');
          psVSA := psVSA + tmpFilename + ';';    
        End;           
      Finally
        tmpList.Free;
      End;    
      // Debug
      psLogWrite(1, '', 'Filename filter as psVSA: ' + psVSA);
      // Set psExitCode
      If psVSA <> '' Then
        psExitCode := 1;
    End.

    limagito file mover copy files from an other source directory

    • We used a Windows folder as Destination:

    limagito file mover windows folder as destination

    • Function is set to Copy in our example but also Move is possible

    limagito file mover function setup

    • If function is set to Copy and you only want to copy the same files once, then please enable our File Memory option:

    limagito file mover file memory option

    • RunTime log result:

    limagito file mover runtime log

    I forgot on line. If I want to delete my pregen file after copy/move, where can I add it on code ?

    In this case some adjustments to the pascal script are needed:

    limagito file mover pascal script option

    limagito file mover pascal script option

    If you need any help with this question, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

  • 03 Sep

    How to exclude files if the date falls on a Sunday or Monday

    How to exclude files if the date falls on a Sunday or Monday

    Q: I have a task where I’m using change notify to check when a new folder is added. I’m filtering the folder by using %TCD:mmdd:, but the problem is I want to exclude the folders if the date falls on a Sunday or Monday. Is there a filter that would allow me to do that?

    A: This is possible using our Pascal Script option.

    • Open our Pascal Script setup:

    limagito file mover pascal script option

    • Please enable and add the following ‘On RuleBegin’ Pascal Script:
    Begin
      psExitCode:= 1;
      // ... add your code here
      IF DayOfTheWeek(Now) in [1,7] Then
        psExitCode := 0;
     
      (*
      The DayOfTheWeek function returns an index number for the day of the week :
      1         = Monday
      2         = Tuesday
      3         = Wednesday
      4         = Thursday
      5         = Friday
      6         = Saturday
      7         = Sunday
      *)    
    End.

    limagito file mover exclude files if the date

    If you need any help with this ‘exclude files if the date’ request, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

  • 30 Jun

    How to move files to different destinations based on the file extension

    How to move files to different destinations based on the file extension

    Q: Since we are dealing with Pharma equipment where we are pulling data off. We would like to be able to split the data into ‘readable’ (ie Txt, excel) and permanent (ie PDF, Image) and place the file types in different subdirectories on the target. At this time, my only solution would be to create two separate rules to accomplish this. Given that there are so many features hidden in your tool that I keep learning about, I was wondering if that was a feature that is in the Mover that I have not found.

    A: Yes this is possible using our Script option.

    • We used a Windows Folder as Source:

    limagito file mover windows folder as source

    • We added the following Filename Include Filters. These are the file extensions we want to split to different destinations.

    limagito file mover filename filter

    • In this example we added 4 destinations. Each Destination has a unique ID:
      • ID1
      • ID2
      • ID3
      • ID4

    We’ll use this Destination ID in our script.

    limagito file mover destination setup

    • Next, please open our Pascal Script option:

    limagito file mover pascal script option

    • Enable and add the following ‘On Destinations’ Pascal Script:
    Var
      tmpFileExt: String;
    Begin
      psExitCode:= -1;
      // ... add your code here
      tmpFileExt := ExtractFileExt(psFilename);
      // psLogWrite(1, '', 'Check File Extension ' + tmpFileExt + ' from ' + psFilename);
      // Check If Destination ID is ID1 AND do we have a .txt file?
      If (psDestinationID = 'ID1') Then 
        If SameText(tmpFileExt, '.txt') Then
          psExitCode := 1; 
      // Check If Destination ID is ID2 AND do we have .xls/.xlsx files?
      If (psDestinationID = 'ID2') Then
        If SameText(tmpFileExt, '.xls') OR SameText(tmpFileExt, '.xlsx') Then
          psExitCode := 1; 
      // Check If Destination ID is ID3 AND do we have a .pdf file?
      If (psDestinationID = 'ID3') Then 
        If SameText(tmpFileExt, '.pdf') Then
          psExitCode := 1;  
      // Check If Destination ID is ID4 AND do we have .png/.jpg/.bmp files?
      If (psDestinationID = 'ID4') Then
        If SameText(tmpFileExt, '.png') OR SameText(tmpFileExt, '.jpg') OR SameText(tmpFileExt, '.bmp') Then
          psExitCode := 1;       
    End.

    limagito file mover different destinations based on the file extension

    • RunTime Log Result:

    limagito file mover runtime log

    This is is just an example of what is possible. If you need any help with this ‘different destinations based on the file extension’, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

1 2 3 4 5 9
SEARCH