Folder, File size and timestamp analysis using PowerShell Folder, File size and timestamp analysis using PowerShell
Joel Plaut

Joel Plaut

September 09, 2014

All Post
Folder,-File-size-
Share:

In just a few lines, one can generate a CSV of all files and their attributes including size and timestamp. I prefer to use TSV (tab delimited) to ensure embedded characters like quotes or commas don’t disrupt the CSV layout.

$q = Get-ChildItem "\serverReserve" -Recurse
#$q | ConvertTo-Csv -NoTypeInformation | out-file "D:DivActAnalyticsACTRDriveFoldersFiles.csv" 
$q2 = $q | select PSPath,PSChildName,   PSIsContainer,BaseName,Length,Name,FullName,Extension,CreationTime,LastAccessTime,LastWriteTime 
 
foreach ($qItem in $q2)
{
   $qItem.PSPath = $qItem.PSPath.replace("Microsoft.PowerShell.CoreFileSystem::","")
}
 
$q2 | ConvertTo-Csv -NoTypeInformation -delimiter "`t" | out-file "D:myFolderReport.csv"

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.