Skip to content

Instantly share code, notes, and snippets.

@uncas
Created March 6, 2012 18:41
Show Gist options
  • Save uncas/1988101 to your computer and use it in GitHub Desktop.
Save uncas/1988101 to your computer and use it in GitHub Desktop.
Copy nuget packages from 'packages' folder to local folder
# Input:
$inputFolder = "D:\Projects"
$destinationFolder = "D:\LocalNuGetFeed\"
if (!(Test-Path $destinationFolder))
{
mkdir $destinationFolder
}
$files = gci $inputFolder -recurse
$packages = $files | where {$_.extension -eq ".nupkg"}
foreach ($package in $packages)
{
$packageName = $package.Name
$destinationFileName = $destinationFolder + $packageName
$packageSize = [math]::round($package.Length / 1KB)
if (!(Test-Path $destinationFileName))
{
"Copies NuGet package $packageName ($packageSize KB)."
copy $package.FullName $destinationFileName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment