How to scp folders with nasty names using a shell function

view full story

http://unix.stackexchange.com – I am trying to write a function that I will put on all my machines in order to make it easy to send files at a fixed place on my network. Here is my script so far. Some folder may have duplicates names on my machines, so I'm adding a uuid at the end of the folder name. function putOnSG3() { uuid=`uuidgen` if [[ -d $1 ]]; then scp -rv "$1" shiny:/Volumes/Seagate3To/"$1.$uuid"; else echo $1 " is not a directory. Not copying."; fi; In action with a folder named: test[ Executing: program /usr/bin/ssh host shiny, user (unspecified), command scp -v -r -t -- /Volumes/Seagate3To/test[.2aac7a48-4a (HowTos)