appleboy / drone-scp

Copy files and artifacts via SSH using a binary, docker or Drone CI.
MIT License
142 stars 30 forks source link

How to copy just folder content? #99

Closed artemanufrij closed 5 years ago

artemanufrij commented 5 years ago

Hey guys, I have a question. How can I copy just content of a folder into target?

What I need: /var/www/drone/app/webplay/files.xyz What I get: /var/www/drone/app/webplay/dist/files.xyz

Here is my current script

- name: deploy
  image: appleboy/drone-scp
  settings:
    host:
      from_secret: drone_server_host
    username:
      from_secret: drone_server_user
    password:
      from_secret: drone_server_pass
    port:
      from_secret: drone_server_port
    command_timeout: 2m
    rm: true
    target: /var/www/drone/app/webplay
    source:
    - dist/*

best regards Artem

snaemi commented 5 years ago

I ran into this situation as well. I think what you want to use is strip_components: 1 in the settings: section. That's what resolved it for me.

That parameter will strip leading path elements when extracting from the tar that's transferred to the target. The documentation here helped me: http://plugins.drone.io/appleboy/drone-scp/

artemanufrij commented 5 years ago

@snaemi thanks a lot! It was exactly what I needed. :1st_place_medal: