gana2188 / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
0 stars 0 forks source link

gsutil cp dir/ should not copy or create parent dir/ in destination #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
# What steps will reproduce the problem?

    gsutil -m cp -r public/ $uri

# What is the expected output? What do you see instead?

## expected output:

using `public/` copies only the subdirectories to the bucket.
note that using `public/*` does work as expected.

these semantics match both rsync and traditional unix cp.

## actual output

using `public/` creates the undesired public/ dir inside the bucket, and all 
content is inside that.

# What is the output of 'gcloud info'?

Google Cloud SDK [0.9.32]

Platform: [Mac OS X, x86_64]
Python Version: [2.7.5 (default, Mar  9 2014, 22:15:05)  [GCC 4.2.1 Compatible 
Apple LLVM 5.0 (clang-500.0.68)]]
Site Packages: [Enabled]

Installation Root: [/repos/google-cloud-sdk]
Installed Components:
  core: [2014.09.10]
  core-nix: [2014.09.10]
  compute: [2014.09.10]
  gsutil-nix: [4.6]
  gsutil: [4.6]
  bq: [2.0.18]
  dns: [2014.09.02]
  sql: [2014.09.02]
  gcutil: [1.16.5]
  gcutil-nix: [1.16.5]
  bq-nix: [2.0.18]
System PATH: 
[/Users/dch/pytools/bin:/Users/dch/perl5/perlbrew/bin:/Users/dch/perl5/perlbrew/
perls/perl-5.16.0/bin:/Users/dch/.rbenv/bin:/usr/local/gems/bin:/usr/local/sbin:
/usr/local/bin:/Users/dch/scripts:/Users/dch/bin:/Applications/VMware 
Fusion.app/Contents/Library:/Users/dch/Applications/Komodo.app/Contents/SharedSu
pport/sdk/bin:./node_modules/.bin:/usr/local/share/npm/bin:/Users/dch/.opam/syst
em/bin:/Users/dch/.opam/system/bin:/Users/dch/.rbenv/shims:/Users/dch/.rbenv/bin
:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/
local/go/bin:/usr/local/MacGPG2/bin:/usr/texbin:/Library/Java/JavaVirtualMachine
s/jdk1.8.0_20.jdk/Contents/Home/bin:/usr/local/share/git-core/contrib/workdir:/u
sr/local/share/git-core/contrib/remote-helpers:/repos/google-cloud-sdk/bin:/usr/
local/lib/python2.7/site-packages:/repos/go/bin]
Cloud SDK on PATH: [True]

Installation Properties: [/repos/google-cloud-sdk/properties]
User Config Directory: [/Users/dch/.config/gcloud]
User Properties: [/Users/dch/.config/gcloud/properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]

Account: [dch@skunkwerks.at]
Project: [sw-lab]

Current Properties:
  [core]
    project: [sw-lab]
    account: [dch@....at]
    user_output_enabled: [True]
  [compute]
    zone: [europe-west1-b]

Logs Directory: [/Users/dch/.config/gcloud/logs]
Last Log File: [/Users/dch/.config/gcloud/logs/2014.09.30/20.28.17.580783.log]

Please provide any additional information below.

Original issue reported on code.google.com by d...@skunkwerks.at on 30 Sep 2014 at 6:30

GoogleCodeExporter commented 9 years ago
I believe this is consistent with how the 'cp' command works. If you want to 
copy the contents of public/, copy public/* and let your shell expand them.

Original comment by jasm...@google.com on 30 Sep 2014 at 6:33

GoogleCodeExporter commented 9 years ago
@jasm nope it's not consistent with cp. From osx:

cp -R -v foo/ bar
foo/ -> bar
foo//archetypes -> bar/archetypes
foo//config.toml -> bar/config.toml
foo//content -> bar/content
foo//layouts -> bar/layouts
foo//static -> bar/static

Original comment by d...@skunkwerks.at on 30 Sep 2014 at 6:43

GoogleCodeExporter commented 9 years ago
On my machine,

$ cp -R -v tmpcp/ tmpdst
`tmpcp/' -> `tmpdst/tmpcp'
`tmpcp/1' -> `tmpdst/tmpcp/1'
`tmpcp/2' -> `tmpdst/tmpcp/2'

Maybe os x is weird?

Original comment by jasm...@google.com on 30 Sep 2014 at 6:46

GoogleCodeExporter commented 9 years ago
seems this is a difference between *BSD and linux. I guess this is something 
we'll need to live with :-(

Original comment by d...@skunkwerks.at on 30 Sep 2014 at 6:49