Invoke–CopyLocalToRemote - anongitmous/k8sShell GitHub Wiki
Copy files and directories from a local source to a destination on remote pods (containers).
[-Containers] <Mtf.Kubernetes.Models.V1K8sContainer[]>
-Source <String>
-Destination <String>
[<K8sShellCommonParameters>]
[<CommonParameters>]
[-Pods] <Mtf.Kubernetes.Models.V1K8sPod[]>
[-ContainerName <String>]
-Source <String>
-Destination <String>
[<K8sShellCommonParameters>]
[<CommonParameters>]
For every result of Get–Pods or Get–Containers piped into this cmdlet, the local file or directory indicated by Source will be copied to the remote directory indicated by Destination.
ℹ️ See A Note about the Examples
1. Copy the 'C:\Staging' directory to the '/home' directory on every pod
- If the
ContainerNameargument is not supplied, then the source pods in this example must have a single container. If not, then the copy operation will fail for that pod.- Using aliasing, the above can be shortened to
ksgp | ksclr -s 'C:/Staging' -d '/home'
2. Copy the 'C:\Staging' directory to the '/home' directory on every container in every pod
- Using aliasing, the above can be shortened to
ksgp | ksgc | ksclr -s 'C:/Staging' -d '/home'
-Containers
- The container(s) resulting from a call to Get–Containers to copy to.
| Type: | Mtf.Kubernetes.Models.V1K8sContainer[] |
| Aliases: | |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
-Pods
- The pod(s) resulting from a call to Get–Pods to copy to.
| Type: | Mtf.Kubernetes.Models.V1K8sPod[] |
| Aliases: | |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
-ContainerName
- The name of the container to copy to.
- Specify along with the
-Podsparameter to specify which container to copy to when the pods have more than a single container.
| Type: | String |
| Aliases: | |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-Source
- Full path of the source file or directory on the local filesystem.
| Type: | String |
| Aliases: | s |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-Destination
- Full path of the remote destination directory to which local file(s) are to be copied.
| Type: | String |
| Aliases: | d |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
K8sShell includes the following alias for Invoke-CopyLocalToRemote:
- ksclr