File Mover Blog

  • 10 Jul

    How to rename files and add the folder name on each file

    How to rename files and add the folder name on each file?

    Q: I was wondering if you could help me.

    I did do quite a bit of searching over the last few days trying to find a solution, and just couldn’t get it worked out.

    I have a lot of folders with PDFs in them.

    The folders are named:
    01-01-2025
    01-02-2025

    and so forth. Each folder has a number of PDFs in them, named as:

    A1.pdf
    A2.pdf
    A3.pdf
    A10.pdf

    and so forth. Each folder has a number of PDFs and they are all identically named, as in letter number.pdf.

    Can you help me get a set up where, if I drop a folder in a source folder, Limagito processes the and puts the folder name on each file, as in

    20250102_A_0001.pdf
    20250102_A_0002.pdf

    and

    20250102_B_0001.pdf

    and

    20250102_A_0010.pdf
    20250102_A_0011.pdf

    and so forth. This would be a move, with the files going into a folder with the same name as the original, if possible.

    This would be really huge if you could help me. I probably have 15 years of folders that need to be processed, for about 20 publications.

    We are trying to send a lot of archives to newspapers.com, and this is the naming convention they prefer.

    If there is anything else you need from me please let me know. Thank you in advance for any help.

    A: Yes this is possible using our Destination file rename option:

    • Windows Folder as Source. Root folder in our case is C:\Test\In_PDF\

    limagito file mover windows folder as source

    • File Filter setup, we only want to handle pdf files in our example:

    limagito file mover filename include filter

    • Directory Filter setup: we only want to handle files within subdirectories one level deep:

    limagito file mover directory filter setup

    • Move Files, during the test we used Copy Files:

     

    limagito file mover function setup

    • Windows folder as Destination:

    limagito file mover destination setup

    • Destination Rename Files:

    limagito file mover file rename setup

    • Rename Files Setup:

    limagito file mover file rename setup

    (.)(\d\d\d\d)\.(.*)
    %SFS:7-10:%SFS:1-2:%SFS:4-5:_\1_\2.\3
    CEM
    (.)(\d\d\d)\.(.*)
    %SFS:7-10:%SFS:1-2:%SFS:4-5:_\1_0\2.\3
    CEM
    (.)(\d\d)\.(.*)
    %SFS:7-10:%SFS:1-2:%SFS:4-5:_\1_00\2.\3
    CEM
    (.)(\d)\.(.*)
    %SFS:7-10:%SFS:1-2:%SFS:4-5:_\1_000\2.\3
    CEM

     

    • RunTime Log Result:

    limagito file mover runtime log

    • Source folders used during this test:

    limagito file mover folder name on each file

    limagito file mover folder name on each file

    limagito file mover folder name on each file

    Feedback from customer:

    OMG… thank you so much. You guys are awesome.
    I’ve tested it and it works perfectly.
    I think this will probably help me with some other files that have single and double digit page numbers.
    You have my deepest appreciation.

    If you need any help with this ‘folder name on each file’ question, please let us know.

    Best Regards,

    Limagito Team

    #regex #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Rename
  • 06 Jul

    Variable for Rule ID in Limagito File Mover

    Variable for Rule ID in Limagito File Mover
    Q: We are running a ‘On Event’ command  to log to our database: sqlcmd -S gp-db4 -d  etc….
    I see there is a variable for Rule name, %RRN but can not see one for the Rule ID.
    limagito file mover Variable for Rule ID
    Why this is important is the Rule name will change and need to use the RuleID as a key. Is this possible?

    A: In version v2025.6.20.0 we added a new Variable:

    Parameters, Added %RRI = Rule, Rule ID

    Customer: That was the ticket!

    CMD /C sqlcmd -S gp-db4.??????.com -d xyzman -U LIMAGITO_STATUS -P <PWD> -Q “EXEC [dbo].[Limagito_OnSuccess] @Server=’%COMPUTERNAME%’, @RuleId=’%RRI'”

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

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Parameters ,
  • 06 Jul

    Having 10 or more groups and want to reference group 1 in RegEx

    Having 10 or more groups and want to reference group 1 in RegEx

    Q: This regex rename is under the unzip…

    My intent is to fix the lack of a leading zero in the MM field of the file name but limagito is seeing it as capture group 10, not capture group 1 with a zero after it.
    Escaping the zero didn’t work either. Is there something else i could have done?
    I eventually hard coded the 2025, because hopefully this is a 1 off error anyway.

    limagito file mover reference group 1 in RegEx

    A: You’ve identified a classic regex gotcha! When you have 10 or more groups and want to reference group 1 followed by a literal “0”, the regex engine interprets `\10` as group 10 instead of group 1 + “0”.

    Here is a solution to solve this: Use \g<n> syntax (most regex flavors)
    # Instead of: \10
    # Use: \g<1>0

    If you need any help with this ‘reference group 1 in RegEx’ question, please let us know.

    Best Regards,

    Limagito Team

    #regex #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Rename
1 2 3 4 156
SEARCH