gsutil cp command copies entire directory path (on Windows) - bug?
Asked Answered
S

1

8

I am having a problem where gsutil does not seem to follow the behavior described in the documentation (at least in Windows). The documentation states:


When performing recursive directory copies, object names are constructed that mirror the source directory structure starting at the point of recursive processing. For example, the command:

gsutil cp -R dir1/dir2 gs://my_bucket

will create objects named like gs://my_bucket/dir2/a/b/c, assuming dir1/dir2 contains the file a/b/c.


However, in practice I have found that it will create objects named:

gs://my_bucket/dir1/dir2/a/b/c

ie, it copies the entire directory path stated in the gsutil command, rather than "starting at the point of recursive processing" (dir2) as stated in the documentation.

Am I missing/misunderstanding something here?

Spears answered 5/6, 2014 at 17:56 Comment(0)
H
15

I noticed the same behavior when using the gsutil cp -R command with a similar directory structure. In order to copy the desired directory from within the 'dir2' level I used the command: gsutil rsync -r dir1/dir2 gs://mybucket

Hands answered 7/7, 2014 at 18:47 Comment(2)
Great just what I been looking for!Sulfonation
Thanks @HandsFoggy

© 2022 - 2024 — McMap. All rights reserved.