Created
November 21, 2013 12:37
-
-
Save hfs/7580876 to your computer and use it in GitHub Desktop.
Script to copy a number of files to a remote host using SFTP. Files are first copied to have a leading dot in the filename and then remotely renamed to their real name. This is useful when large files are copied, a remote process waits for them, it should not "see" unfinished files and it follows the convention to ignore files with a leading dot…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Script to copy a number of files to a remote host using SFTP. Files are first | |
# copied to have a leading dot in the filename and then remotely renamed to | |
# their real name. This script creates the input for the 'sftp' command. | |
# | |
# Usage: | |
# sftp-cp * | sftp user@host:/target/directory | |
for each in "$@"; do | |
echo "put \"$each\" \".$each\"" | |
echo "rename \".$each\" \"$each\"" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment