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.


VKG_2017
2017-12-15T05:00:26Z
Hi,

I am struggling with one of my requirement to rename a file using * (wild card).

My requirement is -

a) I need to fetch complete file name from a folder using *XML_Oracle_Pl-2-0_default_in_xml_reference_1_setup*.xml
Above expression gives me the result like 20171214-020515-XML_Oracle_Pl-2-0_default_in_xml_reference_1_setupLQCWBW1RVN3_2.xml

b) Now i want to rename above file name by remove initial 16 chars which are 20171214-020515-
So new file name should be XML_Oracle_Pl-2-0_default_in_xml_reference_1_setupLQCWBW1RVN3_2.xml

I tried using Rename file task or File Copy but not getting results.

Any prompt response would be much appreciated.

Regards
Sponsor
Forum information
ErikC
2017-12-15T08:43:27Z
Hi VKG_2017,

In your rename settings of the file rename task, use the Post process mask:

{REGEX(MatchGetGroup|{NEWNAME()}|(.{15})-(XML_Oracle_.+\.xml)|2)}


What this does, it cuts the name in two parts, the 1st has 15 characters, the 2nd startst with XML_Oracle en ends with .xml.
The number 2 tells the regex group match to give back the 2nd, so you end up with:

XML_Oracle_Pl-2-0_default_in_xml_reference_1_setupLQCWBW1RVN3_2.xml

Regards,
Erik
Uses Visualcron since 2006.
VKG_2017
2017-12-15T08:57:44Z
Thanks Erik for your quick reply.

Getting some issues again. Let me confirm my settings -

i am using rename file task
In Location tab , 'Include File Mask' i am giving **XML_eagle_ml-2-0_default_in_xml_reference_1_codecategory1LQCWBW1RVN3ND8O_1*.**

In Rename Setting tab, under Post process mask giving below regex
{REGEX(MatchGetGroup|{NEWNAME()}|(.{15})-(XML_EAGLE_.+\.xml)|2)}

What should be the value in New Name Mask text box ?

When i am running , below exception is coming
Exception in Task: Error 183 moving file 'C:\Test11\20171214-020515-XML_eagle_ml-2-0_default_in_xml_reference_1_codecategory1LQCWBW1RVN3ND8O_1.xml' to 'C:\Test11': Cannot create a file when that file already exists.

Please assist.

ErikC
2017-12-15T09:12:57Z
Hi again,

You file rename task should be:

File filter tab:
Include file mask: *XML_Oracle_Pl-2-0_default_in_xml_reference_1_setup*.xml

Rename setting tab:
new name mask: *
Post process mask: checked
Post process mask value: {REGEX(MatchGetGroup|{NEWNAME()}|(.{15})-(XML_Oracle_.+\.xml)|2)}

That's it.

Regards
Erik
Uses Visualcron since 2006.
VKG_2017
2017-12-15T09:27:52Z
Thanks Erik

After making same setting, i got below error execution -

Exception in Task: Error 183 moving file 'C:\Test11\20171214-020515-XML_eagle_ml-2-0_default_in_xml_reference_1_codecategory1LQCWBW1RVN3ND8O_1.xml' to 'C:\Test11': Cannot create a file when that file already exists.
ErikC
2017-12-15T10:35:12Z
Your filename contains eagle, not EAGLE. You should do a correct match or leave it out the postprocess script.

try one of these:
{REGEX(MatchGetGroup|{NEWNAME()}|(.{15})-(XML_eagle_.+\.xml)|2)}
{REGEX(MatchGetGroup|{NEWNAME()}|(.{15})-(XML_.+\.xml)|2)}
{REGEX(MatchGetGroup|{NEWNAME()}|(.{15})-(.+\.xml)|2)}

regards
Erik
Uses Visualcron since 2006.
VKG_2017
2017-12-15T17:51:38Z
Ahh, my mistake.

This is now working perfect.

Great Thanks a lot Erik for your time & support.

Regards
Scroll to Top