Skip to content

Instantly share code, notes, and snippets.

@miraleung
Forked from geedew/vagrant-scp
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miraleung/c5dea1eff1df8da930d7 to your computer and use it in GitHub Desktop.
Save miraleung/c5dea1eff1df8da930d7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
DIR=/dir/to/copy
SERVER=localhost
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`
# File/directory from host to vagrant
scp ${OPTIONS} $FILE vagrant:$PATH
scp -r ${OPTIONS} $DIR vagrant:$PATH
# File from vagrant to host
scp ${OPTIONS} vagrant:$PATH $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment