Rename File task - VisualCron - Forum

Community forum

osirisja
2011-11-09T15:38:34Z
Hi All

This is driving me mad, and it is my (mis)understanding of the task itself.

I am receiving a file (reccy.txt) and I want to rename it once it is downloaded. I am using the 'File Rename' task and have selected post process mask with variable (as I want to prefix the reccy.txt with a variable. I have coded:

{STRING(Replace|{NEWNAME()}|reccy.txt|{USERVAR(@custacct)}_RECCY.TXT)}

But it is just producing the same file name (reccy.txt). I think it has something to do with my misuse of the {NEWNAME()} part of the {STRING(Replace)) function.

Where am I going wrong?

Cheers

Andy
Support
2011-11-09T18:18:34Z
I created a simple Job with a File Trigger and the File Rename Task. I used the exact same Variable string that you used.

I created the same Variable with the value "test".

I placed a file "reccy.txt" in the watch folder.

This is the output that I got (which was expected):

C:\Update\reccy.txt > C:\Update\test_RECCY.TXT
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2011-11-09T21:34:18Z
hi henrik

do you think it might have something to do with the fact that i am doing this in a loop?

if it will help i have exported the job definition (attached)

cheers

Andy
File Attachment(s):
VCMAVENSETUP.ZIP (16kb) downloaded 43 time(s).
osirisja
2011-11-11T00:15:08Z
Hi Henrik

I have spent a lot of time today trying different things with the file rename task. I have to run it in a loop as I am potentially reading more than one trigger files with the same name from different FTP folders.

I am using the post process rename parameter:

{STRING(Replace|{NEWNAME()}|{USERVAR(@trigfile)}|{USERVAR(@triguser)}_{USERVAR(@trigfile)})}

The Output from the Rename task is :
\\10.20.40.71\xxxMail_DATA\@VC\reccy\RECCY.TXT > \\10.20.40.71\xxxMail_DATA\@VC\reccy\RECCY.TXT

....so it clearly isn't renaming the file, although it isn't reporting an error!

If I write the uservar values to a file - {USERVAR(@trigfile)}|{LOOP(CurrentValueXArray,22)}_{USERVAR(@trigfile)} - I get :
'reccy.txt|g2ttci4b_reccy.txt'

so I know the user variables are correct.

I have attached screen shots showing the tasks (and loop), and the Rename File Filter settings.

Any suggestions as to where it is going wrong gratefully received :-)

Cheers

Andy
osirisja attached the following image(s):
Support
2011-11-11T08:23:09Z
You are not making it easy for us 😁

First we want to say that we appreciate all error reports and testing.

In this case, the sample Job you supplied is too complex. You have external files, Variables and a lot of Tasks. It is also not clear what you are trying to accomplish.

We tried to strip it down to 3-4 Tasks and did not see any evident problems (attached). But at the same time we are not sure what you are trying to accomplish.

I would say that it is nearly impossible to take your Job as it is and even try to reproduce something. It would take hours and the risk that we have another environment/setup than you would be great. If we can focus on the actual problem instead of setting up the environment it would be great.

A test case would preferably not include any reference to any file. This leaves out any chance that there is a problem with reading a file through permissions, that format is strange etc. If you want to reproduce a loop we recommend that you just create a Variable, with a maximum of 3 rows.

For simplicity, in all test cases, just use one column and alway refer to that first column.

Have a maximum of 3 Tasks in an example - not a Task more than that is required to reproduce the problem.

Try to keep the Tasks as simple as possible 😁. Often the problem is the complexity.

Be clear what you expect the Job to do in form of result.

These are just general guide lines and all may not apply to you.

By the way, the Rename Task does not currently report an error when no file is found. However, it will in 6.0.5.
File Attachment(s):
test_settings.zip (6kb) downloaded 53 time(s).

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2011-11-11T09:28:16Z
Hi Henrik

Point taken. It is a complicated task, sure enough (but in my head it is really simple!) 😂

Okay - I have tried to break it down to something very simple and it still doesn't work. See attached two screenshots. Accessing a simple file on the local C: drive.

Running the task finishes successfully and STDOUT shows:

C:\@@VC\RECCY.TXT > C:\@@VC\RECCY.TXT

It obviously 'runs' the rename task successfully but it doesn't change the file name. I am coming back to the string:

{STRING(Replace|{NEWNAME()}|reccy.txt|old_reccy.txt)}

Eureka...... And there it is right there! Found the problem Henrik! Hooray!

Okay - it is the Case of the file name! Duh!

I have misread/misunderstood the Rename task dialogue! On the 'File Filter' Tab, there is a check box called 'Case Sensitive' which I have un-checked as I don't know if the file will be upper or lower or mixed case - assuming that this will apply to everything.

On the RENAME SETTINGS Tab, there is no option to Ignore Case so I have assumed it isn't required (inherited from the File Filter).

In this case, I have changed the Post Process Mask to:

{STRING(Replace|{NEWNAME()}|{STRING(ToUpper|{USERVAR(@trigfile)})}|{USERVAR(@triguser)}_{USERVAR(@trigfile)})}

Including the STRING(ToUpper) function, and that resolved it.

So - can the rename task be changed to ignore case for the renamed file as well? As I don't know what case the file will be arriving in.

Also, would it not make sense to display a message in STDOUT saying No File Renamed because a file was not found?

Thanks for all your help Henrik - I did warn you at the beginning that we were going to be pushing the boundaries with Visual Cron. But let me say that so far, it has definitely stood up to the test!!!

Cheers

Andy

Support
2011-11-11T09:33:32Z
Great!

In next version we will show the error in std err column that no files were found (for renaming).

While it might nice to have the case sensitive option to change the result as well it would be inconsistent. The file filter is only for finding files and not affecting the result. But, one could discuss if another option should exist in the Rename settings. I don't think the problem is general and it's good that you found a workaround.

I am glad that you are pushing VisualCron to the limit. Your posts have been useful and especially been able to find errors and limitations in VisualCron. Thanks!
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top