0
특정 변경 집합의 파일 목록을 가져온 다음 TFS에서 파일 목록을 추출하여 내 로컬 작업 영역이 아닌 임의의 폴더에 저장하려고합니다.TFS 2010에서 임의의 폴더로 파일 복사
지금까지 인터넷에서 발견 된 코드 모음에서 변경된 파일을 구문 분석 할 수있었습니다. 자, 내가하고 싶은 것은 그 파일들을 복사해서 "C : \ mypath \ tostuff \ toworkon"에 넣는 것입니다. 여기
내가 파일을 얻고있다 방법은 다음과 같습니다
param(
[Parameter(Mandatory=$True)]
[string] $changesets = $(throw 'Usage: Get-Changeset-Files ''changesets'''),
[Parameter(Mandatory=$False)]
[string] $path,
[Parameter(Mandatory=$False)]
[string] $VOSversion,
[Parameter(Mandatory=$False)]
[string] $environment
)
process
{
# get TFS object
$tfs = get-tfs;
# build up list of file items
$fileItems = @();
$changesets.Split(',') | foreach {
$tfs.vcs.GetChangeset($_).Changes | foreach {
if($path.length -gt 0) {
if($_.Item.ServerItem.Contains($path)) {
if($fileItems -notcontains $_.Item.ServerItem) {
$fileItems += $_.Item.ServerItem;
}
}
} else {
if($fileItems -notcontains $_.Item.ServerItem) {
$fileItems += $_.Item.ServerItem;
}
}
}
}
$downloadFolder = 'C:\mypath\tostuff\toworkon'
foreach ($element in $fileItems) {
$fileItem = $tfs.vcs.GetItem($element);
$contents = ([io.streamreader]$fileItem.DownloadFile()).ReadToEnd();
$contents.CopyTo();
}
return $fileItems | Sort-Object;
}
내 문제는 $contents.CopyTo()
섹션입니다. 나는 그게 정확하지 않다는 것을 압니다. 그것이 내가 붙어있는 부분이다. 내 목표는 어떤 경로에 대해서도 $contents
파일이 모두 한 위치에 복사되므로 폴더 경로를 보존 할 필요가 없습니다.