I run:
PS F:\> gci F:\logs\PRV_RequestLogs\inbound -r -directory | %{ $_.fullname }
and it shows:
F:\logs\PRV_RequestLogs\inbound\2020-02-03
F:\logs\PRV_RequestLogs\inbound\2020-02-04
...
F:\logs\PRV_RequestLogs\inbound\2022-05-09
F:\logs\PRV_RequestLogs\inbound\2022-05-10
then it "hangs" there.
Then I run the following command in another windows trying to find what is going on:
PS F:\> C:\temp\handle64.exe -p 3204
and I found:
ACC: File (RWD) F:\logs\PRV_RequestLogs\inbound\2020-04-28
...
F08: File (RWD) F:\logs\PRV_RequestLogs\inbound\2020-04-28
and the directory keep changing, so So it traverse each directory tring to find sub-directories, there are none but lots of files.
It took hours to complete the process. Never thought of the process would be so slow. It looks like it going through each file and test if it is a directory. Is there a quicker way to do this? I am using powershell 5.0 on Windows 2012R2.