Skip to content

Instantly share code, notes, and snippets.

@eat-sleep-code
Last active August 15, 2020 04:34
Show Gist options
  • Save eat-sleep-code/792d7de9e80e6416dbded4612e638fa5 to your computer and use it in GitHub Desktop.
Save eat-sleep-code/792d7de9e80e6416dbded4612e638fa5 to your computer and use it in GitHub Desktop.
PowerShell script to write out a list of files in a directory
$input = 'C:\input';
$output = 'C:\file-list.txt';
$files = Get-ChildItem $input -Recurse;
foreach ($file in $files){
$fullName = $file.FullName;
$lastWriteTime = $file.LastWriteTime;
Write-Output "$fullName`t$lastWriteTime" | Out-File -FilePath $output -Append
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment