GoogleCloudPlatform / GoogleCloudPlatform/gsutil
[Errno 21] Is a directory
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
## Test environment
### gcloud info
> Google Cloud SDK [278.0.0]
>
> Platform: [Linux, x86_64] ('Linux', 'laptop.localhost', '5.4.14-100.fc30.x86_64', '#1 SMP Thu Jan 23 13:19:57 UTC 2020', 'x86_64', 'x86_64')
> Locale: ('en_US', 'UTF-8')
> Python Version: [2.7.17 (default, Oct 21 2019, 17:20:57) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]]
> Python Location: [/usr/bin/python2]
> Site Packages: [Disabled]
>
> Installation Root: [/usr/lib64/google-cloud-sdk]
> Installed Components:
> kubectl: [2020.01.24]
> core: [2020.01.24]
> beta: [2020.01.24]
> gsutil: [4.47]
> bq: [2.0.52]
> alpha: [2020.01.24]
> System PATH: [//usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin]
> Python PATH: [/usr/lib64/google-cloud-sdk/lib/third_party:/usr/lib64/google-cloud-sdk/lib:/usr/lib/python27.zip:/usr/lib64/python2.7:/usr/lib64/python2.7/plat-linux2:/usr/lib64/python2.7/lib-tk:/usr/lib64/python2.7/lib-old:/usr/lib64/python2.7/lib-dynload]
> Cloud SDK on PATH: [False]
> Kubectl on PATH: [/usr/bin/kubectl]
>
> Installation Properties: [/usr/lib64/google-cloud-sdk/properties]
> User Config Directory: [/home/user/.config/gcloud]
> Active Configuration Name: [default]
> Active Configuration Path: [/home/user/.config/gcloud/configurations/config_default]
>
> git: [git version 2.21.1]
> ssh: [OpenSSH_8.0p1, OpenSSL 1.1.1d FIPS 10 Sep 2019]
## Issue description
When trying to rsync a GCS bucket to a local folder using the command `gsutil -m rsync -P -d -r gs://bucket ./bucket` throws the following error:
> Copying gs://bucket/x/y/abc
> [Errno 21] Is a directory: './bucket/x/y/abc'
> CommandException: 1 files/objects could not be copied/removed.
It basically happens because it tries to override a folder by a file;
This can be explained under the following sequence:
1. The following file is created on GCS: gs://bucket/x/y/abc/1/2;
2. The bucket is synchronized to a local folder;
3. On the bucket size gs://bucket/x/y/abc is removed and replaced by a file with the same key;
4. The bucket cannot sync the same local folder anymore due to the mentioned error;
Contributor guide
Assessment
This issue has not been assessed yet.