Skip to content

Instantly share code, notes, and snippets.

@chodorowicz
Created June 2, 2016 20:40
Show Gist options
  • Select an option

  • Save chodorowicz/73de5124068ab6e417097814d47c9980 to your computer and use it in GitHub Desktop.

Select an option

Save chodorowicz/73de5124068ab6e417097814d47c9980 to your computer and use it in GitHub Desktop.
fswatch + xargs + duck + export variables to environment to go around xargs 255 bytes limit when expanding command
export syncpath="/path/to/folder/"
export remotepath="sftp://[email protected]:2222/remote/path/"
export duckParameters="-y -existing overwrite -p PASSWORD --upload";
fswatch -0 ${syncpath} | xargs -0 -I % -t bash -c 'f="%"; rel=${f#"${syncpath}"}; duck ${duckParameters} ${remotepath}${rel} "${f}"; echo ${rel};'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment