Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.
I am using 7.6.0 and 7.7.0 and trying to rename a file using a couple of wildcards (*) and I am running into the following issue.

The file name is something like this:

and I am trying to drop everything after the .txt, so it should wind up like this:

I tried in both File Copy and Rename File to use various combinations similar to this:

The Copy File task (with the post process mask) runs without error, or output, and does not rename the file.
The Rename File task outputs the following error and fails, deleting the file it is trying to rename

Exception in Task: System.ComponentModel.Win32Exception (0x80004005): Error 2 moving file '\\server\556\LHNS_548_TEHN_GHESGY_CUSTOMER_20151113_060402.txt.5438082.REGISTERED' to '\\server\556\LHNS_548_TEHN_GHESGY_CUSTOMER_20151113_060402.txt.5438082.REGISTERED': The system cannot find the file specified.
at ZetaLongPaths.ZlpIOHelper.MoveFile(String sourceFilePath, String destinationFilePath)

When I use something like this,
The .REGISTERED is replaced with .txt, as expected. However, this of course leaves me with the numbers that I still need to remove.

Am I just missing some way of enclosing the wildcard or something?

Forum information

The wildcard can have some difficulties to rename a file like this, but... there is an other way you can use ;-)

Use in the post process mask the following line:


What this does is using regular expression to match a path of your filename:

.+\.txt matches your filename without the number and REGISTERED part. When using parenthesis around this, you mark it as a group.
So you have (.+\.txt) Next you have to complete the regular expression and I did this by \.[0-9]+\.REGISTERED, what is a dot followed by numbers, a dot and REGISTERED at the end.

So this is your filename with one group in there: (.+\.txt)\.[0-9]+\.REGISTERED
With the MatchGetGroup, you can get this 1st group out of it, and using the number 1 for the 1st group you end up with the filename without the .numbers.REGISTERED

You do not need to use the last file trigger variable but the NEWNAME() is fine ( you could if you would, though).

Uses Visualcron since 2006.
Hi (again),

If you just want the filename without the date time stamp in there you can use the same methodology.
Use this regular expression in stead. The parenthesis are aroud the real filename and you can get it with the matchgroup:


You end up with: LHNS_548_TEHN_GHESGY_CUSTOMER (you have to add a .txt after the post progress mask) :


Uses Visualcron since 2006.
Your 1st mask worked perfectly. I was killing myself trying to figure out why the wildcards were not working.
Scroll to Top