Categories
Coding

Using PowerShell To Analyse The Contents Of A Folder

# The path to interrogate $targetPath = "X:\Shared\FolderToBeInterrogated" # The path to save the exported report $exportPath = "C:\Reports" # Recursively get all files Get-ChildItem -Path $targetPath -Recurse -Force | Select Name, Extension, Length, CreationTime, LastWriteTime, LastAccessTime, FullName | Export-Csv -NoTypeInformation -Force "$exportPath\Report $( Get-Date -f yyyy-MM-dd ).csv"

# The path to interrogate
 $targetPath = "X:\Shared\FolderToBeInterrogated"
# The path to save the exported report
 $exportPath = "C:\Reports"
# Recursively get all files
 Get-ChildItem -Path $targetPath -Recurse -Force | Select Name, Extension, Length, CreationTime, LastWriteTime, LastAccessTime, FullName | Export-Csv -NoTypeInformation -Force "$exportPath\Report $( Get-Date -f yyyy-MM-dd ).csv"