Forum Discussion
Elijah Mothapo
Nov 06, 2017Copper Contributor
Using powershell get size of folder and subfolders on Windows Server 2012 R2
I created script below and I now want to enhance it as I am getting errors. # Create the filename with the current date $filename = ([string]::Format("\\JHBDSM020000128\QlikView\Elijah\Data\Detaile...
Tome Tanasovski
Nov 06, 2017Copper Contributor
You're problem has to do with the output width length. By default, it is truncating due to its nature. A better way is to use a format that preserves data. Either clixml, csv, or json. Here's an example of collecting all of the results in a $stuff array, and then exporting it to CSV:
$stuff=@() foreach($Drive in $drives) { $stuff += Get-ChildItem -Path $Drive.Root -recurse | Select-Object Directory, Name, LastWriteTime, Length } $stuff |export-csv -nottypeinformation -encoding ASCII $filename