How to get File Name in File Copy Task - VisualCron - Forum

Community forum

I need to get the File name in the File Copy task in order to rename it. I thought there would be a variable for this but can't seem to find anything. Maybe I have been staring at this too long. The files coming in to our system have a date and time in the name and that needs to be stripped off to go to it's destination.


Bill Huber
Hi Bill, welcome to the forum!

You could use the option 'Post process mask with Variable - use {NEWNAME()} in Variable'.

I do not know how you source filename is, but lets say it's: YYYYMMDDblabla.txt
So the 1st 8 characters are the date.

You need to trip off the 1st 8, so use the substring funtion:
Use this: {STRING(Substring|{NEWNAME()}|8|???)}

We don't know the length of the remaining part, so we need to get the length of the filename and subtract 8 from it.
Use this: {MATH(Add|Integer|{STRING(Length|{NEWNAME()})}|-8|0)}

Now you can combine both by replacing the ??? and you get:

This will copy the file to a new filename named: blabla.txt
It might be different in your situation, but this is a way to go.

Uses Visualcron since 2006.
Scroll to Top