shocko
New Member.
1822 views

Create Folder with Workflow

Out of the box is there a canned template to create folders with workflows?
If my post was helpful please award me Kudos! or Points 🙂
0 Likes
1 Reply
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Create Folder with Workflow

No, there is no pre-built activity that creates a folder but there are several ways to do it, for example via a VBScript or PowerShell script. If you want to pass in the folder path dynamically you will need two activities: Format a String and Run Script. There are separate activities for running a script on the Aegis server or on a Remote Computer so select the appropriate one. In the Format a String activity, paste this VBS code into the Input String value:

Dim objFS
Set objFS = CreateObject("Scripting.FileSystemObject")
Const NewFolder= "{0}"

If Not objFS.FolderExists(NewFolder) Then
objFS.CreateFolder(NewFolder)

If Not objFS.FolderExists(NewFolder) Then
WScript.Echo "Failed to create folder " & NewFolder
WScript.Quit 1
Else
WScript.Echo "Folder " & NewFolder & " created"
End If

Else
WScript.Echo "Folder " & NewFolder & " already exists"
End If


Then define the full path of the folder to be created as Argument 0.

In the Run Script Activity, select "Run Script Text" with Type Visual Basic Script and the value as the output of the Format a String activity. The script will return exit code 0 for success and code 1 for failure.


Note, it is also possible to create a folder in a single activity either by hard coding the folder path in the VBS text instead of {0} and pasting it into the run script activity. Alternatively you could place the code in a text file and use Wscript.Arguments to pass the folder name dynamically.

I hope this helps but let me know if you need any further assistance.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.