Add-BitsFile

Add-BitsFile

Adds one or more files to an existing Background Intelligent Transfer Service (BITS) transfer job.

구문

Parameter Set: AddFilesFromParams
Add-BitsFile [-BitsJob] <BitsJob[]> [-Source] <String[]> [[-Destination] <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

자세한 설명

The Add-BitsFile cmdlet adds files to a BITS transfer job. You can specify the files to add to the BITS transfer job by name at the command prompt or in a comma-separated value (CSV) file.

Important: An upload job can contain only one file. To upload more than one file, use the Import-CSV cmdlet, and pipe the output to the Add-BitsFile cmdlet. For more information, see example 3 in this Help topic. Or, use a cabinet file (.cab) or a compressed file (.zip).

매개 변수

-BitsJob<BitsJob[]>

Specifies the BITS transfer jobs to which you want to add files. You can pipe a value to this parameter from other cmdlets that return BitsJob objects, such as Get-BitsTransfer.

별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

-Destination<String[]>

Specifies the destination location and the names of the files that you want to transfer. The destination names are paired with the corresponding source file names. For example, the first file name specified in the Source parameter corresponds to the first file name in the Destination parameter, and the second file name in the Source parameter corresponds to the second file name in the Destination parameter. The Source and Destination parameters must have the same number of elements; otherwise, the command produces an error.

별칭

없음

필수 여부

false

위치

3

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-Source<String[]>

Specifies the source location and the names of the files that you want to transfer. The source file names are paired with the corresponding destination file names. For example, the first file name specified in the Source parameter corresponds to the first file name in the Destination parameter, and the second file name in the Source parameter corresponds to the second file name in the Destination parameter. The Source and Destination parameters must have the same number of elements; otherwise, the command produces an error. You can use standard wildcard characters such as the asterisk (*) and the question mark (?), or you can use a range operator such as "[a-r]".

별칭

없음

필수 여부

true

위치

2

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

true

-Confirm

cmdlet을 실행하기 전에 확인 메시지가 표시됩니다.

필수 여부

false

위치

named

기본값

false

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-WhatIf

cmdlet이 실행될 경우 결과 동작을 표시합니다. cmdlet이 실행되지 않습니다.

필수 여부

false

위치

named

기본값

false

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

  • Microsoft.BackgroundIntelligentTransfer.Management.BitsJob[]

    This cmdlet accepts one or more BitsJob objects as input that populates the BitsJob parameter.

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • Microsoft.BackgroundIntelligentTransfer.Management.BitsJob[]

    This cmdlet generates the BitsJob objects that are associated with the BITS transfer jobs to which the files were added.

예제

EXAMPLE 1

This command appends a file to the transfer queue of an existing BITS transfer job.

In this example, the output of the Get-BitsTransfer cmdlet is a BitsJob object that is identified by its unique job ID. The command pipes the job ID to the Add-BitsFile cmdlet. The local and remote names of the file are in the parameters.

PS C:\>Get-BitsTransfer -JobId 10778CFA-C1D7-4A82-8A9D-80B19224879C | Add-BitsFile -Source http://server01/servertestdir/testfile1.txt -Destination c:\clienttestdir\testfile1.txt

EXAMPLE 2

This command appends a set of files to the transfer queue of an existing BITS transfer job.

The first command retrieves the BITS transfer job that is identified by the job ID and then stores it in the $b variable. The second command uses the BitsJob parameter to pass the BitsJob object that is stored in the $b variable to Add-BitsFile.

The server file names are paired with the corresponding client file names.

PS C:\>$b = Get-BitsTransfer -JobId 10778CFA-C1D7-4A82-8A9D-80B19224879C
PS C:\>Add-BitsFile -BitsJob $b -Source http://server01/servertestdir/testfile1.txt, http://server01/servertestdir/testfile2.txt -Destination c:\clienttestdir\testfile1.txt, c:\clienttestdir\testfile2.txt

EXAMPLE 3

These commands add a set of files to the transfer queue of a new BITS transfer job.

The first command creates a new BitsJob object and then stores it in the $b variable.

The second command uses the Import-CSV cmdlet to import a text file that contains a list of files to be transferred. The text file is converted to an array of objects (one per line) and passed through the pipeline to the Add-BitsFile cmdlet. The BitsJob parameter is used to pass the BitsJob object (the transfer job) that is stored in the $b variable to the Add-BitsFile cmdlet. This command also updates the transfer job with the list of files to be transferred.

The third command passes the BitsJob object that is stored in the $b variable to the Resume-BitsTransfer cmdlet. The BITS transfer job is restarted, and the files that are specified in the Filelist.txt file are transferred from the source to the destination.

The "Import-CSV filelist.txt" element of the second command imports a text file that contains the list of files to be transferred. Each line of this file specifies a file to be transferred, in the <Source>,<Destination> format. The text file is converted to an array of objects (one per line) and passed through the pipeline. In this example, the array of objects is passed to the Add-BitsFile cmdlet.

The contents of the Filelist.txt file resemble the following information:

Source, Destination
http://server01/servertestdir/testfile1.txt, c:\clienttestdir\testfile1.txt
http://server01/servertestdir/testfile2.txt, c:\clienttestdir\testfile2.txt
http://server01/servertestdir/testfile3.txt, c:\clienttestdir\testfile3.txt
http://server01/servertestdir/testfile4.txt, c:\clienttestdir\testfile4.txt

PS C:\>$b = Start-BitsTransfer -Suspended
PS C:\>Import-CSV filelist.txt | Add-BitsFile -BitsJob $b
PS C:\>Resume-BitsTransfer -BitsJob $b

관련 항목

Complete-BitsTransfer

Get-BitsTransfer

Remove-BitsTransfer

Resume-BitsTransfer

Set-BitsTransfer

Start-BitsTransfer

Suspend-BitsTransfer