day of the week

  • 16 Feb

    How to move to different destination based on day of week

    How to move to different destination based on day of week

    Q: I was wondering if you have an easy way to determine the day of week based on the filename and move to different locations:

    example:
    ” file_20040218_1″  that is Sunday so it go to folder1
    ” file_20040221_1″  that is Wednesday so it go to folder2
    ” file_20040222_1″  that is thursday so it go to folder2 also
    • In our example we used a Windows folder as Source:

    limagito file mover windows folder as source

    • Next, please open our “Pascal Script” option:

    limagito file mover pascal script option

    • Enable and add the following ‘On Destinations’ Pascal Script: link
      • This script will strip the filename into parts using “_” as delimiter. The second part (= Index [1] of our list),  which is the datepart, will be converted to a TDateTime var. Next we’ll use the DayOfTheWeek function to determine the day mentioned in the filename. The result of the function will be used to set the correct destination folder to our psVSA variable (= %VSA as parameter). We added ctFolder1 and ctFolder2 as Const.

    limagito fil emover pascal script option

    • In our example files from Monday to Friday will go to folder 1 and files from Saturday and Sunday will go to folder 2. This can be easily adjusted.

    limagito file mover pascal script option

    • As Destination we are using [WIN] and the Directory is set to:  %VSA\
      • This %VSA is set by the previous “On Destinations” Pascal Script

    limagito file mover destination setup

    • RunTime Log Result:

    limagito file mover runtime log result

    This is is just an example of what is possible. If you need any help with this ‘destination based on day of week’, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

  • 19 Nov

    How to rename a file to include day of the week

    How to rename a file to include day of the week

    Q: I found this in your blog but my filename pattern is different and I don’t know enough of the Pascal language to edit it.

    Here is an example of what I would like to rename.

    Original Filename: 2023-10-24_section_A2.pdf
    (2023-10-24 = October 24, 2023)
    Rename To:  Tues_2023-10-24_section_A2.pdf

    Any help you can provide would be greatly appreciated.

    A: Please have a look at the following example, I guess we need to fine-tune it. Let us know what you think.

    • We used a Windows folder as source:

    limagito file mover windows folder as source

    • Next, open our Pascal Script option:

    limagito file mover paascal script option

    • Enable and add the following ‘On Destination’ Pascal Script:

    You can download the script: here

    limagito file mover include day of the week pascal script

    • We used a Windows Folder as Destination:

    limagito file mover windows folder as destination

    •  Enable ‘Rename Files during Copy/Move’

    limagito file mover file renaming option

    • Renaming Setup:

    RegEx:   (.*)
    Replacement:   %VSA

    limagito file mover file renaming setup

    • RunTime Log Result:

    limagito file mover runtime log result

    #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘include day of the week’ request, please let us know.

    Best Regards,

    Limagito Team

SEARCH