Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Move Files based on .txt file

$
0
0

Attempting to call a .txt file and -recurse a source directory with sub-directories then move files specified in .txt file. I keep receiving errors... and can't figure the issue out. Please assist.

$GetTXT = Get-Content \\server\apps\1to1100.txt
$sourceDir = \\server\sourcex\sourcexx
$destinationDir = \\server\destinationx\destinationxx
foreach ($strfile in $GetTXT)
{
Get-ChildItem -Path $sourceDir -Recurse | Move-Item -path $sourceDir\$strfile -Destination $destinationDir
}

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles