Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save statgeek/1fc0a8717dd1c07d0af9066a99857342 to your computer and use it in GitHub Desktop.

Select an option

Save statgeek/1fc0a8717dd1c07d0af9066a99857342 to your computer and use it in GitHub Desktop.
List all files in folders and export to a CSV file
<#
Description
A script for finding files in a directory and writing the list out to a CSV file
Modified from this one
#>
Write-Host "Enter Root Directory you would like to search"
Write-Host ""
Write-Host "Example: C:\Users\testuser"
Write-Host ""
$directory = Read-Host ">>"
cls
Write-Host "Enter where you would like the CSV file to be exported"
Write-Host ""
Write-Host "Example: C:\Files.csv"
Write-Host ""
$outPutFile = Read-Host '>>'
cls
Get-ChildItem -path $directory -Recurse | select fullname, *time, length | Export-CSV -Path $outPutFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment