Hi all, My BOT generated daily back folder but I have to get previous Created folder from my backup folders
Any one please
Thanks
Shaik Muktharvalli
Hi all, My BOT generated daily back folder but I have to get previous Created folder from my backup folders
Any one please
Thanks
Shaik Muktharvalli
This expression would get you the latest file
Str_Path = Directory.GetFiles(yourfolder_path,“*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)
Directory.GetDirectories("yourdirectorypath").[Select](Function(d) New DirectoryInfo(d)).Where(Function(d) d.CreationTime.Date.Equals(Datetime.Now.Date)).ToList()
Regards
Gokul
Now
function to get the current date. Assign this value to a variable, e.g., currentDate
.AddDays
function. Assign activity:
previousDate = currentDate.AddDays(-1)
ToString
function for this. Assign activity:
previousDateString = previousDate.ToString("yyyyMMdd")
previousDateString
variable. Assign activity:
backupFolderPath = "C:\YourBackupBasePath\Backup_" + previousDateString
Directory.Exists
function. If the folder exists, proceed with your backup operations. If (Directory.Exists(backupFolderPath)) Then
' Access the previous day's backup folder
Else
' Handle the case where the folder does not exist
End If
Hope it helps!!
backupFolder = "C:\YourBackupFolder"
out_backupFolder = Directory.GetDirectories(backupFolder).OrderByDescending(Function(x) DateTime.ParseExact(Path.GetFileName(x), "yyyyMMdd", CultureInfo.InvariantCulture)).FirstOrDefault()
not latest file , i have to get previous latest folder
for your calrity
I have to get previous updated folder ( In image one folder generated 8:38AM and another one generated 8:39AM) then I have to get previous one means 8:38AM folder
Folders=Directory.GetDirectories("C:\Users\lrtetala\Documents\UiPath\BlankProcess12\New folder")
SortedFolders=Folders.OrderBy(Function(dir) New DirectoryInfo(dir).LastWriteTime).First
Hope this helps!!
can you vaibales type please
can you show vaibales type please
please run this subfolders then i have to get “New Folder 2” because its previous updated folder
Folders=Directory.GetDirectories("C:\Users\lrtetala\Documents\UiPath\BlankProcess12\New folder")
SortedFolders=Folders.OrderBy(Function(dir) New DirectoryInfo(dir).LastWriteTime).ToArray()
MsgBox:SortedFolders(1)
Not working bro…it taking another folder not take excepted folder
Can you share screenshot of your process workflow or xaml because it is working for me
Once confirm the below result you wanted