Upload Files with / (using windows)

204 views
Skip to first unread message

Chetan Shah

unread,
Mar 19, 2012, 4:42:02 PM3/19/12
to gsutil-discuss
I want to upload files which are stored on multiple subdirectories on
my local drive (windows OS). I understand that google cloud storage
has a flat structure and therefore while using gsutil's recursive
option (-R) it will upload all the files recursively from to the
respective bucket name mentioned in the gsutil 's cp -R * gs://<Bucketname>
command. While doing this it appends the path name to the file name
so that the web page references are not broken if the user is hosting
a website and is using the cloud storage to host static files. This is
perfect.

With one issue.

I am using windows and my the host infrastructure is unix based. So
when I upload my files using gsutil from my desktop the files names
get prepended with subdir1\subdir2\file.html instead of subdir1/
subdir2/file.html.

I would highly appreciate if you would please let me know to fix this
so that I can use gsutil to upload my files and then have the correct
path prepended which will look like subdir1/subdir2/file.html

I have tried using cygwin also but i have gotten the same result.

Mike Schwartz (Google Storage Team)

unread,
Mar 20, 2012, 9:24:16 PM3/20/12
to gsutil-...@googlegroups.com
Hi Chetan,

I just tried to reproduce the problem you reported like this:

From windows machine:
python gsutil cp -R gslib gs://my_bucket 

From Linux:
gsutil cp -R gs://my_bucket/gslib .

The paths were correctly converted to having / in the Linux path names.

Can you please tell us the exact commands you typed to upload from Windows and then download from Linux?

Thanks,

Mike

Chetan Shah

unread,
Mar 21, 2012, 11:45:19 AM3/21/12
to gsutil-discuss
Hi Mike -

Below is the command snippet and the respective output :

c:\code\a_dir>python c:\code\gsutil\gsutil cp b_dir/pc/*.html
gs://<mybucket>
Copying file://b_dir/pc\9639.html...
[Setting Content-Type=text/html]
Copying file://b_dir/pc\9640.html...
[Setting Content-Type=text/html]
Copying file://b_dir/pc\9641.html...
[Setting Content-Type=text/html]

After the latest release (3.1), I was able to avoid this by creating
actual sub directories on cloud storage and executing the following
command :
python c:\code\gsutil\gsutil cp -R *.html gs://<mybucket>/subdir1/subdir2

But it is a workaround so my original problem still exists.

On Mar 20, 9:24 pm, "Mike Schwartz (Google Storage Team)" <gs-

Mike Schwartz (Google Storage Team)

unread,
Mar 21, 2012, 12:54:51 PM3/21/12
to gsutil-...@googlegroups.com
Hi Chetan,

Thanks for the clarification. I have opened a gsutil issue about this, including the currently needed workaround. Note that you can add yourself to the Cc list to be informed of any developments on this issue.

Mike
Reply all
Reply to author
Forward
0 new messages