Copy Files

Snippet: Recursively Copy Folder (with excludes) in PowerShell (PowerShell) 
Title: Recursively Copy Folder (with excludes) in PowerShell Language: PowerShell
Description: This function recursively copies a folder and all subfolders while allowing you to properly exclude certain items. Views: 431
Author: Dave Donaldson Date Added: 12/1/2009
 
function CopyFolder($source, $destination, $excludes)
{
    $items = get-childitem $source -recurse -exclude $excludes
    foreach ($item in $items)
    {
        $target = join-path $destination $item.FullName.Substring($source.Length)
        if (-not($item.PSIsContainer -and (test-path($target))))
        {
            copy-item -path $item.FullName -destination $target
        }
    }
}
原文地址:https://www.cnblogs.com/shineqiujuan/p/1993370.html