Creat new folder Automatically in run time

I have a requirement :

  1. Login to xyz.com
  2. Click Find Employee
  3. Get EmployeeID from excel sheet(sequence) {I have 11K records}
  4. Put the EmployeeID in employeid field of Find Employee page and click search
    image
    Above will open
    5.Click on each tab and download files(already have download buttons)
    but on every download file must save in a folder which should be created with employeeId name and under that folder more new folder based on tab names (as seen in screenshot), and every file download from tabs should save in the respected folder created in run time for every tabs.

So is it possible, btw there are many steps but i wanted to keep it short. :slight_smile:

Hey @indrajit.shah,

Yes,It is possible first check for the directory if it already exist if not then create a new directory.

If(NOT Directory.Exists(“Your directory Path which you want to create”))
{
Directory.CreateDirectory(“Your directory Path which you want to create”)
//USE CREATE DIRECTORY ACTIVITY FOR THIS PURPOSE/
}

  1. tell me how do I create the 1st folder with employeeID name?
  2. when download files from each tab like says - after fetching employee “425” i get three tabs (as mentioned in the screenshot above), when downloading file/s from tab “I-9” when downloading a new folder with folder name “I-9” should be created and file get saved in the same folder, and same happens with the tab eForms and so on, but if like document tab don’t have any records then it should not create any folder with name “Document”

Example
image
This will be the folder structure for employeeid “425” and so on …

P.S I have around 11K employee records and for every employee new folder and subfolder will be created files gets downloaded to respective folders

BTW did you get my requirement??

Use the CreateDirectory activity
image

Once you have grabbed the EmployeeNumber as a string, in this case ‘425’ for example, you can then create a folder for that by populating a string variable called ‘EmployeeFolderPath’:

EmployeeFolderPath = "c:\UiPathProject" + EmployeeNumber
image

You can now create sub folders using create directory again and similar variables:
EmployeeDocumentsPath = EmployeeFolderPath + “\Documents”

EmployeeFormsPath = EmployeeFolderPath + “\eForms”

You should set this up as a repeatable sequence with the Employee number as the primary in_Argument so that you can then just invoke it when required.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.