Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading and moving multiple files to a bucket subdirectory don't work as intended #92

Closed
jterrace opened this issue Feb 22, 2013 · 5 comments

Comments

@jterrace
Copy link
Contributor

Original author: mfschwa...@google.com (April 25, 2012 15:19:59)

From messages posted by a gsutil user on gs-discussion and gsutil-discuss:

I have a set of files such that:
python gsutil ls gs://mybucket/x*.gz
gs:// mybucket /xaa.gz
gs:// mybucket /xas.gz
gs:// mybucket /xat.gz
gs:// mybucket /xau.gz
gs:// mybucket /xav.gz
gs:// mybucket /xaw.gz

And I want to move those files to:
gs://mybucket/mysubfolder/

I would have thought the gsutil mv command would work, but I get the error:
"CommandException: Destination URI must name a directory, bucket, or bucket subdirectory for the multiple source form of the cp command."

The command I'm running is:
C:\gsutil>python gsutil mv gs://mybucket/x*.gz gs://mybucket/mysubfolder/

No amount of playing around with the command line seems to be helping unfortunately. I'm using gsutil 3.1 if that helps.


And in another message:

While I can upload files individually, I can't seem to specify uploading all the *.gz files.

Here are the commands I'm running (I'm running gsutil from Windows btw):

This is the command to upload 1 file (works fine, and resumable)
python gsutil -d -h "Content-Type: text/plain" cp file://F:\data\data_split\xaa.gz gs://mybucket/mysubdirectory/

I would have therefore thought the following would be the multiple file equivalent:
python gsutil -d -h "Content-Type: text/plain" cp file://F:\data\data_split*.gz gs://mybucket/mysubdirectory/

However, I get:
CommandException: Destination URI must name a directory, bucket, or bucket subdirectory for the multiple source form of the cp command.

The only way I can get it work as intend is by uploading into the bucket itself. This works correctly:
python gsutil -d -h "Content-Type: text/plain" cp file://F:\data\data_split*.gz gs://mybucket/

Original issue: http://code.google.com/p/gsutil/issues/detail?id=93

@jterrace
Copy link
Contributor Author

From mfschwa...@google.com on April 30, 2012 19:06:51
Fixed in gsutil 3.5

@xiuliren
Copy link

xiuliren commented Dec 3, 2017

I am still getting

CommandException: Destination URI must name a directory, bucket, or bucket subdirectory for the multiple source form of the cp command.

while downloading to a directory. if I change the directory name, it works..
this local directory will not work
/tmp/neuroglancer/drosophila_v0/affinitymap-aligned_z32/rs-unet-cremi-64cores/
this will work
/tmp/neuroglancer/drosophila_v0/affinitymap-aligned_z32/

gsutil -v
gsutil version: 4.28

@sukiakiumo
Copy link

@jterrace I am also getting the same error on gsutil v 4.26

@sukiakiumo
Copy link

Must be an internal network connectivity issue, as I literally did nothing differently, reissued the command, and it worked.

@EvgeniiProkofev
Copy link

gsutil wont accept variable in path. I am getting error for this:
gsutil cp *.jar gs://cloud.bucket/$VAR/
VAR=1.42

CommandException: Destination URL must name a directory, bucket, or bucket
subdirectory for the multiple source form of the cp command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants