Calling `gsutil mv` on a directory/prefix will incorrectly construct destination object path(s) if the destination prefix is a substring of the source prefix
See original GitHub issueFor example
gsutil -m mv gs://bucket/dir/subdir1 gs://bucket/dir/subdir2
sometimes correctly renames to gs://bucket/dir/subdir2
, but other times to gs://bucket/dir/subdir2/subdir1
Coulnd’t pinpoint exactly conditions, but it seems it has nothing to do with trailing slashes. In any case there is nothing about such bahaviour in the docs.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:19 (8 by maintainers)
Top Results From Across the Web
mv - Move/rename objects | Cloud Storage
You can use the gsutil mv command to rename all objects with a given prefix to have a new prefix. For example, the...
Read more >firebase storage: changing folder (file path)'s name with gsutil
You can use the gsutil mv command to rename all objects with a given prefix to have a new prefix. gsutil mv gs://my_bucket/oldprefix...
Read more >Ubuntu Manpage: Rclone - syncs your files to cloud storage
Synopsis Moves the contents of the source directory to the destination directory. Rclone will error if the source and destination overlap and the...
Read more >rclone(1) - Debian Manpages
Source and destination paths are specified by the name you gave the ... Any other string will be used as the share part,...
Read more >Cloud Storage Go Reference
To create a bucket in Google Cloud Storage, call BucketHandle.Create: ... If a CRC32C is sent, and the data in the destination object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If there’s an existing subdirectory called gs://buciket/dir/subdir2 before you run that mv command it will put subdir1 under subdir2. That is correct behavior - it emulates similar behavior of Unix directory renames. Please see https://cloud.google.com/storage/docs/gsutil/commands/cp#how-names-are-constructed for more details.
@mfschwartz I understand but this was not the case. I tried it again just to make sure.
unfortunately, it’s seems to be hard to reproduce though, I ran this once and it misbehaved, but then 3 times it worked as expected (with different names every time)
gsutil version: 4.19