How to move files to shared location

Hi Team,

I have one shared location so I want to move the input files to shared location.
In Shared location i have to check if month floders available or not for example 1 January, 2 February like this.
If I will run the bot in February month I need to check if 2 February floder is available or not if not I need to create the folder and also inside Feb floder I have create Excess floder and inside the excess floder need to Backup floder and finally I have to move the input files in to backup floder.

Note: if I will run in Oct month BOt need to create the 10 October floder .

How do create the folder dyn

Thanks

before moving folder to destination
assign current month to varible
eg - current_month =DateTime.ParseExact(“01/01/2023”, “dd/MM/yyyy”, Nothing).ToString(“dd MMMM”)
first check inside destination folder that condition where the current month folder is present or not

folder exist activity
path+current_month

if the folder present then move files to that folder
path+currentMonth

if no create folder

Hi @Rohan_Ashok_Gaikwad ,

can you please explain in detail
I didn’t understand

let me create sample workflow and will share with you

@Baby123

you use this expression in the path exists to know whether the folder is exists or not

"YourFolderpath\"+now.ToString("M MMMM")

Gives Boolean output use if activity in else block use create folder activity to create the folder

Hi @Baby123

Check out the below workflow:
→ Use the below syntaxes in Assign activities:

sharedLocation= "C:\"
currentMonth= DateTime.Now.ToString("MM")
monthFolderPath= Path.Combine(sharedLocation, currentMonth + " " + DateTime.Now.ToString("MMMM"))
excessFolderPath= Path.Combine(monthFolderPath, "Excess")
backupFolderPath= Path.Combine(excessFolderPath, "Backup")

All the variables are of DataType System.String. Make sure to change the path in sharedLocation variable. So your shared location will be ending like this "kepptherequiredpath\2024 Monthly Billing"

→ After the Multiple Assign I have used Folder Exists and If. If the folder is already present, it won’t create a new folder. Same in the case of Excess and Backup folder.

Workflow:

Xaml:
Sequence17.xaml (15.3 KB)

I’m happy to help if you face any difficulties.

Regards

Hi ,

Use path exist activity in order to check if the folder already exist skip and create folder using create folder activity.

Hi @mkankatala ,

I have checked the above flow but I want create the floders like 1 January, 2 February etc…

Using above flow getting 01 January, 02 February like this

Can you please guide me

use string manipulation
pad right method\

or use if condtion

if day_Var.contains(“0”)

then “01 January”.substring(1,length)

else then take whole day

@Baby123

According to above flow if you run on January 01 January folder will be created inside that Excess Folder will be create and Inside Excess Folder Backup Folder will be created. Same in the case, If you run in February 02 February Folder will be created and inside that Excess Folder will be create and Inside Excess Folder Backup Folder will be created.

Check the below image for better udnerstanding:



I’m happy to answer any further questions you may have.

Regards

I forgot to create the 2024 floder also
Create 2024 floder then month , excess, backup floder.

1st I need to create 2024 Monthly Billing floder dynamically.

@Baby123

2024 Monthly Billing floderIs this the folder name. Please specify

Regards

@Baby123

Check out the below workflow:
→ Use the below syntaxes in Assign activities:

sharedLocation= "C:\"
currentYear= DateTime.Now.ToString("yyyy")
YearFolderPath= Path.Combine(sharedLocation,currentYear+" Monthly Billing Folder")
currentMonth= DateTime.Now.ToString("MM")
monthFolderPath= Path.Combine(YearFolderPath,currentMonth+ " " + DateTime.Now.ToString("MMMM"))
excessFolderPath= Path.Combine(monthFolderPath, "Excess")
backupFolderPath= Path.Combine(excessFolderPath, "Backup")

All the variables are of DataType System.String. Make sure to change the path in sharedLocation variable.

→ After the Multiple Assign I have used Folder Exists and If. If the folder is already present, it won’t create a new folder. Same in the case of Excess and Backup folder.
Workflow:


xaml:
Sequence17.xaml (18.6 KB)

Hope it helps!!
Regards

@Baby123
Output will be like below:




Regards

Hi @mkankatala ,

How to check entire shared path like…

C:\2024MonthlyBilling\1January\Excess\Backup\

How to check above path dynamic using UiPath???

Thanks

Hi @Baby123

→ Use below syntaxes in Assign activities.

sharedLocation= "C:\"
currentYear= DateTime.Now.ToString("yyyy")
YearFolderPath= Path.Combine(sharedLocation,currentYear+"MonthlyBilling")
currentMonth= DateTime.Now.ToString("MM")
monthFolderPath= Path.Combine(YearFolderPath,currentMonth+ " " + DateTime.Now.ToString("MMMM"))
excessFolderPath= Path.Combine(monthFolderPath, "Excess")
backupFolderPath= Path.Combine(excessFolderPath, "Backup")

All the variables are of DataType System.String. Make sure to change the path in sharedLocation variable.
→ Use Folder Exists activity and give the below condition and store the output and it’s datatype is Boolean.

Path.Combine(sharedLocation,YearFolderPath,monthFolderPath,excessFolderPath,backupFolderPath)

→ Use If condition if the folder does not exists, it will create a folder.

Check the below workflow: for better understanding:
Sequence17.xaml (12.7 KB)

Output:





Hope it helps!!
Regards

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