Renaming Files With Dynamic Parameters Using MOVEit Automation

Renaming Files With Dynamic Parameters Using MOVEit Automation

So, you have installed MOVEit Automation and have started to create automated workflows for moving files from one location to another. But with that initial requirement now fulfilled, what else can you get out of the solution?This is a question we are answering on an almost weekly basis.

One area which we find there to be an increased level of interest over others, is the automated renaming of files using dynamic parameters, such as the date, time, source, file type or even something sourced from another location.

But, how can this be achieved?

 

How to Change File Names

 

In most scenarios, the requirement is to change the name of a file after its collection from the source and before it is delivered to the destination.

In order to configure this behaviour,  you must untick the option in the destination settings labeled as "use original filename(s)". This then reveals a file name box in which the modification mask can be applied.

MOVEit Automation Destination Source SettingsThe pre-existing [OrigName] is a MOVEIt Automation macro which is a placeholder for dynamic content applied during the execution of the workflow. In this case, the parameter being used applies the original file name as the final file name.

 

Making Additions to the File Name

 

Adding to the filename is as simple as entering the characters before or after the original file name macro, should you wish to keep it. If you do not want to keep the original file name as part of the final file name, you can remove it.

For example, you may wish to add a site abbreviation to the beginning of the file name.MOVEit Automation Editing Destination File NamesHowever, should you wish to add dynamic content you can choose from the array of MOVEit Automation macros to create your desired results.

A sample of some of the macros available are below:

[FileDateStamp] - The date stamp of the file as recorded by the source, in the form YYYY-MM-DD HH:MM:SS. Not all sources provide date stamps.

[FileSize] - The size of the file, in bytes, as recorded by the source. Note: some unusual FTP servers do not provide the file size; in these cases, a size of 0 is used.

[FolderID] - Unique number identifying a MOVEit folder. For example: class="monospace">1236518.

[FolderName] - Name of remote folder. This macro returns only the last part of the path. Example: Given a full remote path of frog\dog\cat, this macro returns cat.

[FullPath] - The full path of the file as it was on the source, including all directories and the filename.

[ID] - Unique number identifying a MOVEit file. For example: 251660214.

[NominalStart] - The time this task was officially started in YYYY-MM-DD HH:MM:SS format (for example, 2006-07-18 11:33:16). This value combined with the TaskID yields a key that uniquely identifies a single task run, for example, in the "stats" database table.

[OrigComment] - The upload comment that was specified when the file was uploaded. (This is often blank.) 

The full list can be found here: https://docs.ipswitch.com/MOVEit/Automation2019/Help/Admin/en/index.htm#32705.htm

Macros can be added directly to the destination file name field to achieve the desired effect.MOVEit Automation Macros

 

Removing Parts of the Original File Name

 

In a similar fashion, it is possible to modify original file names so that elements which are not required are removed.

Much like the example above where a site abbreviation was added to a file name, files collected at the source may contain prefixes or postfixes which are not desired at the destination.

In this scenario we make use of macro functions to remove parts of the name returned by the [OrigName] macro. Take for example, the following:MOVEit Automation Macro FunctionsIn this example, the MID macro function takes the original file name provided by the [OrigName] macro and removes the first three characters - referenced by the pointer four which instructs the file name to begin at the fourth character.

Other macro functions include the below:

LEFT(arg, count) - Returns the leftmost "count" characters of "arg". If arg is less than count characters long, the entire string is returned.

LEN(arg) - Returns the number of characters in "arg", as a decimal number.

MID(arg, start, count) - Returns "count" characters from "arg", starting at position "start" (where 1 is the first character). If ", count" is omitted, then the function returns the characters starting at "start" and going through the end of "arg". For example, if the original filename is ABCDE.TXT, then the value of the macro [MID([OrigName], 2, 3)] is BCD and the value of [MID([OrigName],2)] is BCDE.TXT.

RIGHT(arg, count) - Returns the rightmost "count" characters of "arg". If arg is less than count characters long, the entire string is returned.

 

We have over eleven years of technical experience with MOVEit Automation and other MOVEit solutions. If you would like to learn more about the solution or ask us for help with your requirements, you can book a call with one of our product specialists here.


Systematic Case Study for Ipswitch MOVEit