regex

  • 08 Jun

    How to rename a file using its parent folder name

    How to rename a file using its parent folder name

    Q: When working with Limagito, we were wondering if you had recommendations on how to handle this scenario.

    1. We would like to transfer files from a directory lets call it E:\Orignal Location. I have two folders and files under this directory below.
      • Under E:\Orignal Location\UNIT_1_4.1.2025\history.xml
      • Under E:\Orignal Location\UNIT_2_5.1.2025\history.xml
    2. We would like to rename the history.xml to the parent folder name, highlighted above, while moving it to final file location E:\Final Location
    3. The file result we are looking for is for two files in the location  E:\Final Location:
      • UNIT_1_4.1.2025.xml
      • UNIT_2_5.1.2025.xml

    How would you recommend configuring, or is it possible to configure the renaming since the value we want to rename is the parent name, while also moving the file to a new location with Limagito.

    A: We did a test with pdf files instead of xml, but the result would be the same.

    In your case,  E:\Orignal Location\ would be the WIN Source

    Our Directory Filter setup:

    limagito file mover directory filter option

    limagito file mover directory setup

    Destination Setup:

    limagito file mover destination setup

    limagito file mover destination options

    limagito file mover Windows folder as destination

    Please uncheck ‘Create Subdir’ because all files should go to the same folder:

    limagito file mover destination file and directory options

    Enable ‘Rename Files during Copy/Move’

    limagito file mover destination file rename option

    – Add the following file renaming setup:
    RegEx:  (.*)\.(.*)
    Replacement:  %SFS.\2

    limagito file mover destination file rename setup

    – Alternative file renaming setup when you have multiple levels of subfolders:

    • %SFS:?=?: parameter option was added recently
      • %SFS:0=1:
        • 0 > start at the end of the subfolders(s) Var %SFS > %SFS = Source File Subfolder(s)
        • 1 > use the last subfolder part only
    RegEx:  (.*)\.(.*)
    Replacement:  %SFS:0=1:.\2

    limagito file mover file renaming setup

    – RunTime Log result:

    limagito file mover runtime log result

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

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team How-to Rename , ,
  • 16 Feb

    How to use parameters within the regex rename option

    How to use parameters within the regex rename option

    Q:  have a case where I’m getting several files from a folder. I’m getting the following files with my filter:

    20240212_P2.pdf

    20240213_P2.pdf

    Where 20240212 represents the date. I’m wanting the files output it to so they are consecutive pages on the same day:

    20240213_P1.pdf

    20240213_P2.pdf

    In my file rename in the destination, I know that I could do something like (20240212)_([A-Z]\d+).pdf in the regex so I can accurately match the file, but it would be really cool if I could use (%TCD:mmddyyyy)_([A-Z]\d+).pdf with the parameter being used as a literal to match on, but I know Limagito is not setup to do that. This is more of a feature request as it would make it really useful.

    Thanks for all you guys do!

    A: We added a new option in v2024.2.16.0 to allow this. This is an advanced option, so it is a bit ‘hidden’.

    • Schedule button > Advanced Tab > “Allow Params In RegEx Renaming”:

    parameters within the regex rename option

    • File rename example using parameters within the RegEx field:

    limagito file mover file renaming using regex

    If you need any help with this ‘parameters within the regex rename option’ question, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Rename , ,
  • 11 Feb

    Lower case file rename using regular expression

    Q: We are having some trouble coming up with a proper reg-ex that will rename our files properly, and would like some advice.

    We are receiving files that are named as follows.

    ABCDE_ABC

    We would like to rename them to

    ABCDE_abc

    We have found several reg-ex commands that will do this, but none of them seem to work in the Limagito application. I am sure we have something wrong, but I am unable to find something that will give us the output that we want.

    Do you have any suggestions? Or perhaps an example string?

    Q: Yes this is possible using our File Rename option in your Destination setup:

    • Destination “File Rename” Setup

    Limagito File Mover Destination File Rename Setup

    > We are receiving files that are named as follows: ABCDE_ABC

    > We would like to rename them to ABCDE_abc

    We guess these file have a file extension so you could use:

    Lower Case File Rename RegEx

     

    #FileTransfer #RegEx

    If you need any info about this ‘lower case file rename ’ request, please let us know.

    Best regards,

    Limagito Team

SEARCH