The CurrentDate function is one of the most common and useful functions in GoAnywhere Director, and the subject of Rick’s Tip of the Month.
Date and time stamps are used frequently throughout the Managed File Transfer (MFT) environment. Archiving files and folders, date specific file movement and date/time sensitive file processing are just a few of the business applications where the use of the CurrentDate function is essential.
GoAnywhere Director allows you to create date/time values through the use of this CurrentDate function. Let’s step through a common project scenario where we will copy a file from one folder to another, and append the current date to the file name.
To begin, create a project, add a copy task and then add a source file and destination similar to the example in Figure 1 below
On the advanced tab, place your cursor in the "File Name Suffix" field and then click the $VAR button on the right (Figure 2) to show the expression wizard (Figure3)
From the Expression Wizard, you can pick the functions you need to manipulate your variable data. In this example, we need to get the Current Date. Hover over “CurrentDate” in the Function column and the function description appears in the Description pane. By clicking on the “CurrentDate” function, the Field Value is updated to include the function. You then have the option to modify the pattern to match the desired format of the date needed, or accept the default.
For our example, we are using the default ISO standard date. Edit the field value to remove the pattern text and then press "Done" to update your file name suffix value.
Now, execute your project and review your job log. You will see that the copy task completed as follows:
Code: Select all
Executing task 'copy 1.0 (Copy file to Archive)' File 'C:\temp\gademo.txt' (228 bytes) was successfully copied to 'C:\temp\DestDirA\NewFileName.txt.2013-12-11' (228 bytes)
1 file(s) copied successfully
Finished task 'copy 1.0 (Copy file to Archive)'
Notice that the current date has been appended to the end of your destination file name.
Please feel free to contact Linoma Software with any questions or to inquire about our on-site Professional Services or Training Programs.