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.


Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-03T17:48:58Z
I need to create job that moving the multiple files from same folder to another folder,
I have created 3 task first is list file task in this I got 3 file name
the second task is rename the file task so question is I want to rename those files as 1XX.csv,2XXX.csv and 3XXX.csv so How can I do that in rename task?

I have tried many thing but it didn't work
can anyone help me about this

Thanks
Sponsor
Forum information
jrtwynam
2019-07-03T18:33:01Z
You could try using {LOOP(PositionY)}. In the Rename task, on the Rename Settings tab, set the New Name Mask like this:

{LOOP(PositionY)}XXX.csv


What does the XXX signify? Does that indicate the old file name or something? If so, you could try this:

{PATH(GetFileName|{LOOP(CurrentValueX)})}


That will get you the file name of the current file in your loop (no file extension). Then you could set the New Name Mask like this:

{LOOP(PositionY)}{PATH(GetFileName|{LOOP(CurrentValueX)})}.csv


That would take a file named "MyFile.csv" and rename it to "1MyFile.csv" (or "0MyFile.csv" - I don't remember off hand if the loop counter in VC starts at 1 or 0). That assumes that all files will be *.csv files... if they aren't, you could also use a similar variable to get the proper file extension from the path.
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-03T19:55:22Z
hey, Thanks for your quick reply,
XXX is for old file name

{LOOP(PositionY)}{PATH(GetFileName|{LOOP(CurrentValueX)})}.csv I have tried this code.
it's showing me this error
\\10.206.15.53\ppout\public\EX6\07022019203605EX6.csv > \\10.206.15.53\ppout\public\EX6\[Current context (running Task) is not in a loop][Current context (running Task) is not in a loop].csv
\\10.206.15.53\ppout\public\EX6\07022019204428EX6.csv > \\10.206.15.53\ppout\public\EX6\[Current context (running Task) is not in a loop][Current context (running Task) is not in a loop].csv
\\10.206.15.53\ppout\public\EX6\07022019204617EX6.csv > \\10.206.15.53\ppout\public\EX6\[Current context (running Task) is not in a loop][Current context (running Task) is not in a loop].csv

Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-03T20:11:16Z
loop setting 2.png Loop setting.png

this is my loop settings for this job
Support
2019-07-03T21:06:25Z
Most likely the Job that you want to use the Variable in is not in the actual loop.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-03T21:55:11Z
I have 1st task as list file task I got 3 names in there as output then in the second task rename file task I want to rename those 3 files as 1XX.csv , 2XX.csv and 3XX.csv so I have created loop that starts from first task and end in second task , so what's wrong in this setting
Please help me with this.

loop setting 3.png
jrtwynam
2019-07-04T13:52:57Z
I would say that you want your List Files task to be OUTSIDE the loop, because otherwise it would keep refreshing the list on each iteration through the loop. Whether or not this is a problem depends on how VC would handle this.

As for your error, it seems that the rename task is not within the loop. Can you post a screenshot of the list of tasks in the job?
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-04T13:59:03Z
yes sure,
here is the list of task.
loop setting 4.png
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-04T17:03:44Z
loop setting 5.png loop setting 6.png

here is the my loop setting and rename setting.

now, it's just pick the first file and rename it to the 0CUDP 1 instaed of it should doing 0CUDPoldfilename.csv

can you please help me with this as soon as possible, I tried so many things in this not working.

Thank You
jrtwynam
2019-07-04T18:46:56Z
If it's naming it to "0CUDP 1", that tells me that at least the {LOOP(PositionY)} part is working. I can only assume that the value you have in your loop settings in the "for each row x in" field is correct for the output of your List Files task - there's no way for me to validate that. Everything else there looks good to me, though. I also don't see an issue in your list of tasks - it seems to make logical sense. List the files, loop through the list and rename each one, then copy them all to a different location. Send an email if anything failed (I assume there's some sort of flow added to that task).

I just created a small task for me to try stuff. Here's the files before running the job:

SS1.png

And here they are after running the job:

SS2.png

I have the tasks set up like this:

SS3.png

Here's my List Files task:

SS4.png SS5.png

And here's my Rename Files task:

SS6.png SS7.png
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-04T19:40:23Z
hey thanks for your efforts,
I will try this, can you please share screen shot of your loop setting please
Thanks
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-04T21:04:00Z
one more question.
does loop counter for vis cron job starts from 0 by default?

Thanks
jrtwynam
2019-07-05T11:54:41Z
Sure, here's my loop setting:
SS8.png

It looks like the loop counter starts at 0, but if you really want your counter to start at 1, you could do this:
SS9.png
Ujma
  •  Ujma
  • Paid support Topic Starter
2019-07-05T15:24:58Z
Scroll to Top