Tuesday, July 25, 2023

Upload and Download files.


 The Start-BitsTransfer cmdlet creates a Background Intelligent Transfer service  (BITS) transfer job to transfer one or more  files between a client computer and server.
 

### 1.following command will create BITS transfer job that downloads a file from server
 

```sh 
    Start-BitsTransfer -Source "http://server/test/file1.txt"  -Destination "C:\clientdocs\testfile1.txt"
   			#or
 	Start-BitsTransfer "http://server/test/file1.txt"  "C:\clientdocs\testfile1.txt"
```		
 
### 2.following command will create BITS transfer job that upload a file to server
 
```sh
 	Start-BitsTransfer  -Source "C:\docs\testfile1.txt"  -Destination "http://server/test/file1.txt"  -TransferType Upload 
    	   #or
 	Start-BitsTransfer "C:\docs\testfile1.txt" "http://server/test/file1.txt"  -TransferType Upload
```

### 3.following command will create BITS transfer jobs that download multiple files 

```sh
     Import-CSV filesToDownload.txt | Start-BitsTransfer -Asynchronous -Priority Normal 
     
     #Note: The content of the filesToDownload.txt resemble the following  information
       <#
           Source , Destination 
           "http://server/test/file1.txt","C:\clientdocs\testfile1.txt"
           "http://server/test/file2.txt","C:\clientdocs\testfile2.txt"
           "http://server/test/file2.txt","C:\clientdocs\testfile2.txt"
       #>#
```
 
### 4.following command will create BITS transfer jobs that download multiple files.

```sh
    Start-BitsTransfer  -Source  "C:\docs\*.log"  -Destination "\\server1\docs\"  -TransferType Download
```
 
### 5.following command will create BITS transfer jobs that download multiple files 
 
```sh
    Import-CSV filestoUpload.txt |Start-BitsTransfer  -TransferType Upload
    
      #Note: The content of the files.txt resemble the following  information
       <#
           Source , Destination 
           "C:\clientLogs\testfile1.log" , "http://server/logs/file1.log"
           "C:\clientLogs\testfile2.log" , "http://server/logs/file2.log"
           "C:\clientLogs\testfile2.log" , "http://server/logs/file2.log"
       #>
```
 
  

No comments:

Post a Comment