Just wanted to help people out if they run into this problem on Windows. As administrator:
- Open
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\utils
- Delete
copy_helper.pyc
- Change the permissions for
copy_helper.py
to allow writing
- Open
copy_helper.py
- Go to the function
_GetDownloadFile
- On line 2312 (at time of writing), change the following line
download_file_name = _GetDownloadTempFileName(dst_url)
to (for example, objective is to remove the colons):
download_file_name = _GetDownloadTempFileName(dst_url).replace(':', '-')
- Go to the function
_ValidateAndCompleteDownload
- On line 3184 (at time of writing), change the following line
final_file_name = dst_url.object_name
to (for example, objective is to remove the colons):
final_file_name = dst_url.object_name.replace(':', '-')
- Save the file, and rerun the
gsutil
command
- FYI, I was using the command
gsutil -m cp -r gs://my-bucket/* .
to download all my logs, which by default contain :
which does not bode well for Windows files!
Hope this helps someone, I know it's a somewhat hacky solution, but seeing as you never need (should have) colons in Windows filenames, it's fine to do and forget. Just remember that if you update the Google SDK you'll have to redo this.