GoogleCloudPlatform / GoogleCloudPlatform/gsutil
Folder and file can coexist in the same folder
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
# Test environment
## gcloud info
```
Google Cloud SDK [299.0.0]
Platform: [Linux, x86_64] uname_result(system='Linux', node='mirko-tp', release='5.7.8-100.fc31.x86_64', version='#1 SMP Thu Jul 9 15:16:52 UTC 2020', machine='x86_64', processor='x86_64')
Locale: ('en_US', 'UTF-8')
Python Version: [3.7.7 (default, Jun 4 2020, 15:43:14) [GCC 9.3.1 20200408 (Red Hat 9.3.1-2)]]
Python Location: [/usr/bin/python3]
Site Packages: [Disabled]
Installation Root: [/home/mirko/google-cloud-sdk]
Installed Components:
beta: [2020.06.26]
core: [2020.06.26]
cloud-datastore-emulator: [2.1.0]
app-engine-python: [1.9.91]
gsutil: [4.51]
bq: [2.0.58]
System PATH: [/home/mirko/.npm-packages/bin:/home/mirko/.gems/bin:/home/mirko/.npm-packages/bin:/home/mirko/google-cloud-sdk/bin:/home/mirko/.gems/bin:/usr/share/Modules/bin:/usr/condabin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/mirko/.composer/vendor/bin:/var/lib/snapd/snap/bin:/home/mirko/sbin:/home/mirko/sbin]
Python PATH: [/home/mirko/google-cloud-sdk/lib/third_party:/home/mirko/google-cloud-sdk/lib:/usr/lib64/python37.zip:/usr/lib64/python3.7:/usr/lib64/python3.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [False]
Installation Properties: [/home/mirko/google-cloud-sdk/properties]
User Config Directory: [/home/mirko/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/home/mirko/.config/gcloud/configurations/config_default]
Account: [xxx@xxx.com]
Project: [xxx]
Current Properties:
[core]
account: [xxx@xxx.com]
disable_usage_reporting: [True]
project: [xxx]
Logs Directory: [/home/mirko/.config/gcloud/logs]
Last Log File: [/home/mirko/.config/gcloud/logs/2020.07.26/11.19.03.705205.log]
git: [b'git version 2.25.4']
ssh: [b'OpenSSH_8.1p1, OpenSSL 1.1.1g FIPS 21 Apr 2020']
```
# Issue Description
Steps to reproduce:
1. Create local folder abc with some files
2. Upload the folder to a bucket
3. Remove the local folder abc
4. Create a local file named abc
5. Upload the local file to the same bucket and same prefix/folder
6. Both the file and the folder should be there
Script to reproduce
```
#!/usr/bin/env bash
BUCKET_NAME="YOUR BUCKET NAME"
gsutil rm -R gs://$BUCKET_NAME/output/
mkdir -p "output/abc"
echo "some" > output/abc/some.txt
gsutil -m rsync -R -x "\\.history" "output" gs://$BUCKET_NAME/output
rm -r output/abc
echo "some" > output/abc
gsutil -m rsync -R -x "\\.history" "output" gs://$BUCKET_NAME/output
rm -r output
```
# Other Info
I have discovered this while rsyncing back the contents to my local machine as it throws this error https://github.com/GoogleCloudPlatform/gsutil/issues/956
Not sure if this is a bug or expected behaviour for GCS
Contributor guide
Assessment
This issue has not been assessed yet.