oc rsync command on WIndows always yielding "The system cannot find the path specified"

156 Views Asked by At

I am trying to copy files from a pod running on an OpenShift cluster to my local Windows system. My first attempt was oc rsync <podname>:<path_to_file_on_pod> C:\temp

That ended in an error message interestingly telling me that rsync isn't available (which turned out to be true) and that I should install cwRsync (an rsync implementation using Cygwin to run on Windows) and then try again. So I downloaded and installed cwrsync_6.2.11_x64_free.zip, unzipped it and added its bin directory to my path and restarted my shell.

With Cygwin as a basis for the tool comes that one can not use the normal Windows path but needs to specify paths to e.g. C:\temp... as "/cygdrive/c/temp/...".

This Rsync/cwRsync seems to work - executing e.g. rsync /cygdrive/c/temp/folder1/test.txt /cygdrive/c/temp/folder2 faithfully copied a test-file from folder1 to folder2.

But as soon as I prefix this command with oc this always fails claiming that it could not find the Windows-side path. E.g.:

oc rsync "test-pod-6bdc6dd8f5-qspvz:/temp/test" /cygdrive/c/temp/

yields

error: invalid path /cygdrive/c/temp/: CreateFile /cygdrive/c/temp/: The system cannot find the path specified.

It doesn't seem to depend on the location (I also tried other destination paths but always with the same error result). No matter what path I specify, it can not be found.

Any idea what I am missing here?

BTW: I even tried a local operation only, i.e. not copying from a pod but on my local machine only: oc rsync /cygdrive/c/temp/folder1/test.txt /cygdrive/c/temp/folder2 (i.e. a local rsync only) but even that yields the same "error: invalid path /cygdrive/c/temp/folder1/test.txt: CreateFile /cygdrive/c/temp/folder1/test.txt: The system cannot find the path specified."

1

There are 1 best solutions below

2
MaxExplode On

Since rsync has two strategies "rsync, tar", you don't need to install rsync or cyg on your Windows machine, just make sure your pod has tar installed in the image. And to download the file, assuming you have a folder created in c drive "temp"

oc rsync test-pod-6bdc6dd8f5-qspvz:/temp/test C:/temp