cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create Year Month and date wise folder

AnkitShukla
Level 4

How to Create Year Month and date wise folder



------------------------------
Ankit Shukla
RPA Developer
Arvius Software Pvt Ltd.
Noida
------------------------------
3 REPLIES 3

PvD_SE
Level 12

Hi Ankit,

In object 'Utility - File Management', you'll find an action 'Create Directory'. That action will create a new folder with your chosen name.

How's that 'Foundation' course coming along?



------------------------------
Happy coding!
---------------
Paul
Sweden

(By all means, do not mark this as the 'Best answer'! )
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

GeoffHirst
Staff
Staff

Hi Ankit,

Thank you for being a SS&C Blue Prism customer and for using Blue Prism.

I think I can help you here.

Using the File Management VBO and the Create Directory action, you can create a folder very easily, all you have to do is provide the path to the folder you wish to create. It will throw an exception if you try to create a directory that already exists.

The potentially more complex part comes in creating the folder path, or more specifically the folder name in terms of a date.

If you have a date value, then you can build the folder name as follows.

Create a new action in a VBO.

Create a Date data item and for ease call it DateIn.

Create a Text data item and for ease call it Date Out.

In your objects action, create a calculation stage that accepts a date. 

In the expression area type the following: FormatDateTime([DateIn], "yyyy-MM-dd")

Set the Store Result In drop down to the text item you created, Date Out.

Now, place a valid date value in the Date In data item, if you have not already done so.

Connect the stages and if everything is correct you will see the YMD value in the Date Out, all you need to do from here is pass that out of this action and into an action using the Create Directory action of the File Management VBO.

For future reference, I will see about adding this functionality to the strings VBO as it may be of use elsewhere.

Come back to me if you need more help.

regards



------------------------------
Geoff Hirst
Senior DX Engineer - Digital Exchange - EMEA
SS&C Blue Prism
------------------------------
Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism

MichealCharron
Level 8

@Ankit Shukla

You could always use a little known feature of the underlying .Net Format() method of Blue Prism Date Formatting functions. You can use pretty well any characters as long as you enclose them in double quotes and use backslashes that are escaped with another back slash. So for instance:

FormatDateTime(Today(), """Z:\\Reports\\Year-""yyyy""\\Month-""MM, MMM""\\Day-""dd, dddd")

Will produce a result of "Z:\Reports\Year-2023\Month-12, Dec\Day-07, Thursday".

21743.png
Using the "Create Directory" action in Blue Prism's "Utility - File Management" VBO, any intervening folders will be created if they do not exist. Also, you can set the "Error If Already Exists" parameter to False (or blank as False is the default) and the action will not throw an exception if the folders already exist.
 
21744.png



------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------

Micheal Charron
RBC
Toronto, Ontario
Canada