Created
October 26, 2018 15:43
-
-
Save chriscooning/e5d85b6ef9355eb807cbd99b91b934fa to your computer and use it in GitHub Desktop.
[powershell] Move a csv list of files from one directory to another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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