Create multiple (sibling) folders in one task - VisualCron - Forum

Community forum

Eddie Kumar
2019-02-21T12:31:34Z
Hi,

We need to create about 10 sibling-folders in a folder (e.g. under C:\Test\ we need folders called: T1, T2 .. T10). Can we do this in one task? or do we need to add 10 separate tasks for this. Please note that all these folder need to be created in the C:\Test\ folder i.e. they have to be created at sibling-level (not at child-levels i.e. sub-folders within sub-folder).

Also, the Copy File task allows us to add multiple copy commands within the same Task, is it possible with the Create Folder task?

Thanks in advance.
Eddie
thordw
2019-02-21T13:27:17Z
Hi

If the name on the folders are constant.
I'd create a job variable containing a list of the folder names you want.

Then create a "Create folder" task, have it in a loop using the job variable.
And just create the structure you need from the values in the list.
Eddie Kumar
2019-02-21T17:32:17Z
Originally Posted by: thordw 

Hi

If the name on the folders are constant.
I'd create a job variable containing a list of the folder names you want.

Then create a "Create folder" task, have it in a loop using the job variable.
And just create the structure you need from the values in the list.



Thanks for your response, I did as you suggested but it only creates the First folder, what I did is:

  • I created a Job-Variable containing 3 strings (dir1, dir2, and dir3) separated by New-line char
  • I am using For-Each loop construct, which has above Job-variable as Collection/Array, e.g. {JOB(Active|Variable|DIR_STRUCTURE)}
  • In the "Create Folder" task I'm using path\{LOOP(CurrentValueX)}

This only creates the First folder from the list, i.e. only "dir1" gets created (but "dir2" and "dir3" are not being created).
What am I doing wrong please?

job-vars.PNG loop_settings.PNG Create_folder_task_setting.PNG

Changing "Field Separator" didn't make any difference.

Also, the Loop - Documentation  is not verbose (didn't help).
thordw
2019-02-22T09:12:33Z
Hi

That setup should, I tried it my self and it worked.

It created one (1) folder for you, you said.
As a test, in the job variable, instead of new line, separate each value with comma.
And then in the loop change field separator to comma and give it a try.
Eddie Kumar
2019-02-22T10:56:47Z
Originally Posted by: thordw 

Hi

That setup should, I tried it my self and it worked.

It created one (1) folder for you, you said.
As a test, in the job variable, instead of new line, separate each value with comma.
And then in the loop change field separator to comma and give it a try.



It's working now 😁

Sorry, my bad, under the "Flow" tab, I had "Stop" selected for "On success" (lesson learnt copy-paste code/Task is a bad habit 😢 )

Thanks very much for your time, really appreciate it.

Cheers.
Scroll to Top