I have a directory on a server that contains 2.5 million files.
I need to do something with the files. However, when I try to create an object representing those files, I run into a memory limit. (It’s a 32 bit machine.)
PS D:\> $files=dir LotsOfFiles
Get-ChildItem : Exception of type 'System.OutOfMemoryException' was thrown.
Is there any way to work around this, like create a class representing a file that stores fewer attributes (I just need name and lastwritedate)?
did you try using
dir /b LotsOfFiles?