pmistry
(Priyank Mistry)
July 16, 2021, 5:03pm
1
Hi I want to create logic to count below two scenarios…
Path 1 > /B: (count folders by latest date modified)
Path 2 > /B:>patient case number> .NC (count all .NC files within different patient case folder)
the only way to group patient case folder and .nc files are with date modified.
Thank you for the help
Directory.GetDirectories("YourFolderName").Where(Function(x) New FileInfo(x).LastWriteTime.Date = Now.Date).Count
Above will give you the count of the folder with recent modified date…
I didn’t get your second Requirement…Could you please brief with some example?? Thanks…
pmistry
(Priyank Mistry)
July 16, 2021, 5:38pm
4
second que…
lets say i have folder A, withing that folder i have 100 folders for patients. within those 100 patients folders there are .nc files which i want to count by modified dates.
hope you now got the que
pmistry:
.nc files
So .nc is the extension? like .xlsx or .docx
OR .nc is within the filename itself??
pmistry
(Priyank Mistry)
July 16, 2021, 6:46pm
6
sorry… yes it is file extension
Here you go…
Here is my workflow…
For Each ==> Type Argument = String
Directory.GetDirectories("YourParentFolder").Where(Function(x) New FileInfo(x).LastWriteTime.Date =Now.Date).ToArray
IntCount = Directory.getfiles(EachFolder).where(function(y) path.GetExtension(y).Contains(".xlsx")).Count
Here IntCount is Int32 varaible
IntFinalCount = IntFinalCount+IntCount
Here IntFinaCount is Int32 varaible
In this example I am looking for .xlsx files and I got the count of 13(manually verified). Feels free to changed based on your requirement.
Idea is: Get the folder with date modified equals today. And then loop these folders and look for the file extension and increment the count.
Hope this helps…
pmistry
(Priyank Mistry)
July 16, 2021, 7:49pm
8
can you share the .xaml if you dont mind pls
@pmistry - please find the xaml
FileCounts.xaml (7.6 KB)
pmistry
(Priyank Mistry)
July 16, 2021, 7:57pm
10
thank you really appreciate
1 Like
system
(system)
Closed
July 19, 2021, 7:58pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.