Filters

  • 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

  • 17 Mar

    How to move files to different ftp folders under the same root

    How to move files to different ftp folders under the same root on the same server

    Q: Conditional destination request. We are looking for an easy way (one channel) to move files to different ftp folders (more than 100 folders) under the same root on the same server, where filename prefix (3 char) is the key to which folder. Prefix and folder name are different.

    A few examples:
    • BBL > folder1
    • ABB > folder2
    • BYR > folder4
    • BYP > folder5
    • DAT > folder6
    I have been looking at your blog post without finding anything like it. The list of prefixes and folders could be a text table in the script or in a csv file. Do you have a script for this?
    A: Yes this is possible, please have a look at the following screenshots. This setup can be used with other Sources and Destinations too.
    – We used a Windows folder as Source:
    limagito file mover windows folder as source
    – Open our Pascal Script option
    limagito file mover pascal script option

    Please enable and add the following ‘On Destination’ Pascal Script:

    • Please add the following script: link
      • The script strips the first 3 characters from the filename by using ‘copy(psFilename, 1, 3)’
      • The stripped part is compared with ‘BBL’, ‘ABB’ .. ‘DAT’
      • Depending on the result of the compare, a folder name is added to our variable psVSA ( pascal script Var String A )
      • This psVSA variable will be used in the Destination setup as parameter (%VSA, which contains data from psVSA)
    • You’ll need to adjust the folder names and add more prefixes if needed
    files to different ftp folders
    – In the FTP as Destination Setup, please adjust the ‘Create Subdir’ option to:   %VSA\%SFS
    • Here we used the %VSA parameter, set in the Pascal Script, which contains the desired subdirectory name
    limagito file mover destination setup
    – Feedback customer:

    That looks easy. Thank you very much.

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

    Best Regards,

    Limagito Team

    #ftp #sftp #managedfiletransfer #filetransfer #filemanagement

  • 18 Feb

    How to copy files in a specific order to the correct location

    How to copy files in a specific order to the correct location

    Q:  Here is the challenge:

    1. Copy job files  (3 total)  in a specific order to the correct location.
    2. There are 3 file formats:
      • XML
      • USF
      • JPG
    3.    The XML must be copied first,  followed by the JPG and finally the USF.

    Is this something you can help with?

    A: Yes this would be possible with our tool. In version v2024.2.18.0 we added an option to achieve this.

    Our idea is to use 3 Rules (tasks):

    • Rule 1: Will copy the the files from the source into temporary subfolders with the name of the file without its extension.
    • Rule 2: Will check if all three files are available and copy them in a specific order to the destination.
    • Rule 3: Will do the cleanup of the temporary folders we used.

    limagito file mover rule listing

     

    Rule 1:

    • We used a Windows folder as source:

    limagito file mover windows folder as source

    • “Filename Include Filter” is to only include xml, usf and jpg files:

    limagito file mover filename filter setup

    • We enabled our file memory option so we’ll only handle the same source files once:

    limagito file mover file memory option

    • Function is set to “Copy” so the original files stay at their source:

    limagito file mover function setup

    • As destination we used a Windows folder:
      • This temporary Destination folder will be used in the ‘On Destination’ Pascal Script of Rule 2.

    limagito file mover windows folder as destination

    • We’ll copy the source files into subfolders with the name of the source file without its extension. This way a job consisting out of three files will reside with one subfolder.

    limagito file mover destination subfolder setup

    Rule 2:

    • The new option to achieve this request is available under our “Schedule Setup”. Switch to “Advanced” tab:
      • Select ‘Root filepath & extension descending (Z to A) – Reset Exit Output on filepath change’
      • Enable ‘Exit Output to Destination On Error’

    limagito file mover copy files in a specific order

    • As source we used a Windows folder but important, the folder itself is a parameter, %VSA
      • Don’t mind if it is marked red, this is because the parameter is empty during the setup.
      • This %VSA parameter will be used in our ‘On Rule Begin’ Pascal Script option.

    limagito file mover windows folder as source

    • Please open our ‘Pascal Script’ option:

    limagito file mover pascal script option

    • Enable and add the following ‘On Rule Begin’ Pascal Script:
      • Please add the following script: link
      • Don’t forget to adjust the ctScanPath Const. This path must be the same as the Destination folder of Rule 1.
      • The script will scan the temporary root folder for subfolders, these subfolders are added to our psVSA var (= %VSA parameter).

    limagito file mover on rule begin pascal script

    • Enable and add the following ‘On Destination’ Pascal Script:
      • Please add the following script: link
      • This script will check if all three files (xml, usf and jpg) of a job are available.

    limagito file mover on destination pascal script

    • We enabled our file memory option int the second Rule also because we want to handle copy errors:

    limagito file mover file memory setup

    • Function is set to ‘Copy’:

    limagito filemover function setup

    • As Destination we also used a Windows folder:

    limagito file mover destination setup

    • RunTime Log result:
      • There is a missing file for Job ‘TestFile2’, so we’ll retry this one during the next scan.
      • All three files are available for Job ‘TestFile’, so all three files are copied in the specific order as requested.

    limagito file mover runtime log result

    • Source folder of Rule 1:

    limagito filemover examples

    • Destination folder of Rule 1:

    limagito filemover examples

    • Destination subfolder of Rule 1:

    limagito filemover examples

    • Destination subfolder of Rule 1:

    limagito filemover examples

    • Destination folder of Rule 2:

    limagito filemover examples

     

    Rule 3:

    • Will handle the cleanup of the temporary folder we used: C:\Test\EDemo\Tmp

    If you need any help with this ‘copy files in a specific order’ request, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Filters
1 2 3 4 7
SEARCH