Skip to content

Instantly share code, notes, and snippets.

@yzorg
Created September 17, 2015 02:28
Show Gist options
  • Save yzorg/3dac89c7dfb9489fa837 to your computer and use it in GitHub Desktop.
Save yzorg/3dac89c7dfb9489fa837 to your computer and use it in GitHub Desktop.
copy selective list of files from text file using PowerShell and xcopy
'c:\git\mycompany_prj2\Legacy\Comp1\f1.cs
c:\git\mycompany_prj2\Legacy\Comp2\Domain\f2.cs
c:\git\mycompany_prj2\Legacy\MyWeb\web.config' > files.txt
cd c:\git\mycompany_prj2
$dest = '..\project_archive\prep_6.11_merge'
if (!(Test-Path $dest)) { md $dest -Verbose }
gc .\files.txt | %{
$rel = (Resolve-Path -Relative $_)
xcopy $_ (Join-Path $dest $rel*) /Y
}
@yzorg
Copy link
Author

yzorg commented Sep 17, 2015

Thanks for xcopy * trick from SO: http://stackoverflow.com/a/14488464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment