Hi UiPath,
I need help with my situation.
Lets say I have the following sub folders inside my main folder 2022
my question is how can I save my example file to the specific month equal to may file name?
Example: Payment_Breakdown03152022
In this case it will be save in March folder.
please advise and let me know
thanks!
Gokul001
(Gokul Balaji)
2
Hi @Alvin_Apostol2
Try this expression
Environment.CurrentDirectory+"/"+DateTime.Now.ToString("yyyy")+"/"+DateTime.Now.ToString("MMM")+"/Payment_Breakdown"+DateTime.Now.ToString("MMddyyyy")
Regards
Gokul
Hi @Alvin_Apostol2 ,
Is computing the Folder Name based on the File Name enough?
If the filepath is constant throughout then this ought to work:
Retrieve the month from given FileName →
Convert.ToInt32(System.Text.RegularExpressions.Regex.Match(str_filePath,"(?<=[A-z])\d{2}").Value)
Compute Month →
System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(int_month).Substring(0,3)
GetFolderNameBasedOnMonth.xaml (5.5 KB)
Kind Regards,
Ashwin A.K
Yoichi
(Yoichi)
4
Hi,
Another solution:
yourFileName = "Payment_Breakdown03152022"
fileDate = DateTime.ParseExact(System.Text.RegularExpressions.Regex.Match(System.IO.Path.GetFileNameWithoutExtension(yourFileName),"\d+$").Value,"MMddyyyy",System.Globalization.CultureInfo.InvariantCulture)
yourPath = System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory),"PF-Payment Recon",fileDate.ToString("yyyy"),filedate.ToString("MMM"),yourFileName)
Note: fileDate is DateTime type
Regards,