• 12 Nov

    How to merge and add filenames to csv datafiles

    How to merge and add filenames to csv datafiles

    Q: I have a new daily job where I will receive 3 CSV files. I need to merge these together and also add a new field to the data that contains the original filename as I need to split them later on in the process and use the original filename to send back to the client. Also, I may not always get all 3 files so the rule needs to work for receiving 1,2, or all 3 files.

    We will run the rule at 18:00 for example and process however many files have been uploaded, then run the rule every 1 hour after to pick up any files that the client has uploaded late. The ideal scenario would be for all 3 files to be uploaded by the client by the scan time, but they want us to be able to pick up any files they may upload late.

    The data does not contain headers either. I’m sure I have asked this before but I can’t find the solution if I have, I have found similar and have tried to amend it to suit but failed miserably.

    A: We asked and received the following example files:

    • BTW_Invites_20231023_1.csv
    • BTW_Reminders_20231023_1.csv
    • BTW_Results_20231023_1.csv

    We used a Windows folder as Source:

    limagito file mover windows folder as source

    We added the following ‘Include Filename’ Filter because we want to be sure to only process .csv files:

    limagito file mover filename filter setup

    As Destination we add our ‘Pascal Script’ option:

    limagito file mover destination setup

    Destination Pascal Script, do not forget to adjust the ctOutputPath const (Path must end with a \ ).

    The script will add the filename of the source csv file to the end of each entry of the merged csv file. The Destination merged csv file is determined by stripping parts of the source filename. In our example it will be: ‘BTW_Merged_20231023_1.csv’.

    This script is just an example and it can be adjusted so it fits your needs, just let us know.

    You can download the script: here

    limagito file mover merge and add filenames script

    RunTime Log Result:

    limagito file mover runtime log result

    #csv #filetransfer #filemanagement

    If you need any help with this ‘merge and add filenames’ option, please let us know.

    Best Regards,

    Limagito Team

  • 21 Mar

    Q&A 41: Merge Multiple Input Files Into a Single Output File

    Q: Merge Multiple Input Files Into a Single Output File. We have a new requirement where we have multiple input files , but when this info is moved to the target server, then it should be combined into one single file – named for example… ‘ELEC_WHT_PRICESHEET.CSV’. Is there a way to combine all the input files into one output file?

    A: With WIN as Destination we have a File option: ‘Append if file exists’. The trick is to use the file rename option to rename the source files you want to append to the same destination filename.

    Limagito File Mover Merge Files

    Destination File Rename option:

    Limagito File Mover Merge Renaming

    If you need any help with this ‘Merge Multiple Input Files’ request, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Q&A WIN , ,
  • 27 Nov

    How-To Merge PDF Files using PDF as Destination

    Merge PDF Files

    A little how to merge pdf files using LimagitoX File Mover.

    We prepared the following Source folder with 8 single PDF pages numbered from 1 to 8.

    Selected WIN as Source and added the folder above as Input.

    In the Schedule Setup select the Advanced Tab. Set ‘Source File Sort Order’ to ‘Filename ascending (A to Z)’.

    Set the File Name Filter to only include PDF files ( *.pdf ). Just to be sure.

    Add PDF as Destination

    In the PDF Setup screen, add a PDF Action. Set this action to ‘Output PDF File’. We also changed the ‘Description’ to ‘Merge PDF Files’.

    Select the ‘Output’ Tab and set the Output Directory. Enable ‘Merge Pages’ and select ‘Last Ascending’ as ‘Insert Pages Position.

    Select the ‘Rename’ Tab and enable ‘Rename Files during Copy/Move’.

    Renaming Setup. This one is very important. We need a UNIQUE filename as result for all source pdf files you want to merge.

    In our example we want to merge: IntroXFM.1.pdf until IntroXFM.8.pdf

    So for all of these 8 files we need a unique output file. We separated the source file in 3 parts. Each part was separated by a dot. As replacement we took the first en third part which results in a unique filename for all of the 8 source files (IntroXM.pdf). Because due to this renaming it finds the file already in the destination and will merge the next source pdf file to it.

    Result: Multipage PDF file in the Output folder.


    If you need any help, just let us know. Don’t hesitate to ask.


    Limagito Team

    By Limagito-Team PDF ,