Skip to content

Instantly share code, notes, and snippets.

@chriscooning
Created October 26, 2018 15:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chriscooning/e5d85b6ef9355eb807cbd99b91b934fa to your computer and use it in GitHub Desktop.
Save chriscooning/e5d85b6ef9355eb807cbd99b91b934fa 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