Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thewriteway/1b851a4b0cb2f0b27a0aa6ffb7246d0d to your computer and use it in GitHub Desktop.
Save thewriteway/1b851a4b0cb2f0b27a0aa6ffb7246d0d to your computer and use it in GitHub Desktop.
[powershell] Move a csv list of files from one directory to another
$file_list = Get-Content C:\example.csv
$search_folder = "C:\example"
$destination_folder = "C:\example"
foreach ($file in $file_list) {
$file_to_move = Get-ChildItem -Path $search_folder -Filter $file -Recurse -ErrorAction SilentlyContinue -Force | % { $_.FullName}
if ($file_to_move) {
Move-Item $file_to_move $destination_folder
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment