Hi Team,
Could you please help me for writing LINQ Query for getting all bthe files from folder whose Last modified date > (CurrentDate-15)
Thanks in advance !!
Hi Team,
Could you please help me for writing LINQ Query for getting all bthe files from folder whose Last modified date > (CurrentDate-15)
Thanks in advance !!
Assign: currentDateMinus15Days = DateTime.Now.AddDays(-15)
For Each (item) in Directory.GetFiles(“your_directory_path”)
If
File.GetLastWriteTime(item) > currentDateMinus15Days
Then
// Perform actions with the file
End If
End For Each
Hope it helps!!
Try this
Directory.GetFiles("FolderPath").Where(function(x) New FileInfo(x).LastWriteTime> Now.Adddays(-15))
cheers
Variable: files
(Array of String) Value: Directory.GetFiles("C:\YourFolderPath").Where(Function(file) File.GetLastWriteTime(file) > DateTime.Now.AddDays(-15)).ToArray()
For Each Activity:
Check the below linq expressions to get all the files from Directory whose Last Modified Date > CurrentDate-15
Directory.GetFiles(FolderPath).OrderByDescending(Function(d) NewFileInfo(d).Creation>DateTime.Now.adddays(-15)).toList()
Hope it helps!!
string folderPath = @"C:\Your\Folder\Path";
DateTime currentDate = DateTime.Now;
DateTime fifteenDaysAgo = currentDate.AddDays(-15);
string[] files = Directory.GetFiles(folderPath)
.Where(filePath => File.GetLastWriteTime(filePath) > fifteenDaysAgo)
.ToArray();
VB:
FoolderPath As String = "C:\Your\Folder\Path"
currentDate As DateTime = DateTime.Now
fifteenDaysAgo As DateTime = currentDate.AddDays(-15)
files As StringArray = Directory.GetFiles(folderPath).
Where(Function(filePath) File.GetLastWriteTime(filePath) > fifteenDaysAgo).
ToArray()
Actually I have implemented workflow using UiPath Activities but need to use LinkQ, Thanks Anyways
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.