-
-
Save thewriteway/1b851a4b0cb2f0b27a0aa6ffb7246d0d 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