add local runner, fix some bugs
diff --git a/ssh_copy_directory.py b/ssh_copy_directory.py
index d074fcf..265133c 100644
--- a/ssh_copy_directory.py
+++ b/ssh_copy_directory.py
@@ -29,6 +29,11 @@
def put_dir_recursively(sftp, localpath, remotepath, preserve_perm=True):
"upload local directory to remote recursively"
+ # hack for localhost connection
+ if hasattr(sftp, "copytree"):
+ sftp.copytree(localpath, remotepath)
+ return
+
assert remotepath.startswith("/"), "%s must be absolute path" % remotepath
# normalize