3 of 3 people found this helpful
Within a File Transfer job, if you have successfully watched a file using a variable, you can share that variable to an additional transfer in the Source path within the same job using the following variables:
- $$WATCH_ALLn$$: Determines the full file name including the extension of the successfully watched file
- $$WATCH_NAMEn$$: Determines the file name only without the extension of the successfully watched file
- $$WATCH_EXTn$$: Determines the extension of the successfully watched file.
NOTE: n represents the number of the watch/transfer of the possible 5 in the job.
If you selected the Rerun from point of failure checkbox, you cannot use the above variables.
And within the advanced general parameter settings (still using File Transfer jobs) -
The File name field in the After the completion of a successful file transfer the source file will be, After the completion of a successful file transfer the destination file will be and Create Empty File fields parameters can contain variables, constants, and the following variables:
- AFTFILE$$: Contains the name of the original file without file extension. (If there was an extension, it is always added to the name of the file.)
- $$AFTFILE_ALL$$: Contains the full file name including the extension
- $$AFTFILE_NAME$$: Contains only the name of the file until the last dot (without the extension).
- $$AFTFILE_EXT$$: Contains only the extension of the file name
EXAMPLE: If you want to rename a transferred file old_cmd_060101.exe, when it was originally named cmd.exe, the pattern you must specify is old_$$AFTFILE$$_%%DATE.
What Operating System are you working with?
And, if your file names are of standard length, you can use the %%SUBSTR feature to extract the desired portion of the variable.
1 of 1 people found this helpful
Unix. I actually found something that works. With the filewatcher I am saving the file found to a variable in the advanced options. I then created an OS job to run after this that echoes that variable and I take off the extention with an xargs command. I then capture the filename without the extension in the capture output action to save that to a variable.
I actually found something that works. With the filewatcher I am saving the file found to a variable in the advanced options. I then created an OS job to run after this that echoes that variable and I take off the extention with an xargs command. I then capture the filename without the extension in the capture output action to save that to a variable. The problem with using the $$AFTFILE$$ options was that I need to use the filename in a job later downstream and not in the original filewatcher/FTP job.
Thanks for you input!
1 of 1 people found this helpful
Not sure whether you are looking into filewatcher job or ftp job. If you are working on a filewatcher job, you can try the following solution which does not require an additional OS job.
A filewatcher will have a line that looks like this if it's watching for a file, /tmp/*.txt.
1204 09:44:33 : File transfer was completed. The size of file '/tmp/test.txt' is 9 bytes. id=1. Modified 04/12/2019 09:43
For V9 and above, you can make use of "Capture from job output" feature. Since another job will be making use these variables, you have to use either Global or Named Pool variable. In my example below, I'm using Global variables.
To capture filename including extension:
To capture filename without extension:
Thank you Tully and Mark! I did not see that I could use a . as the delimiter in the capture! That works perfectly! Thank you for all your help!
Application Technical Analyst
Trinity Health | 20555 Victor Parkway | Livonia, MI 48152
Open a ticket for Control-M Here: