1 Answers
Hmmm… I’m interested to know more about what you’re doing, because the -R
option has definitely worked for me. It copies recursively and preserves the hierarchy as it does so.
It’s a quick-and-dirty script, but you can run this in your Cloud Shell to make a test hierarchy of directories and files and upload it recursively to a bucket:
#!/bin/bash
mkdir ~/hierarchy
cd ~/hierarchy/
mkdir 001
mkdir 002
mkdir 003
cd 001
mkdir a
mkdir b
mkdir c
cd a
touch aaa
echo Hello>bbb
echo Lalalalalalalalalalalalala>ccc
cp * ../b
cp * ../c
cd ..
cd ..
cp -R 001/* 002/
cp -R 001/* 003/
cd ..
gsutil cp -R ~/hierarchy gs://mytestbucket/