Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For this, I'd suggest to use rsync rather than scp, as it is far more powerful. Just put the following in an executable script. Here, I assume that all the files (and nothing more) is in the directory pointed to by local_dir/.</p> <pre><code>#!/bin/env bash rsync -azrp --progress --password-file=path_to_file_with_password \ local_dir/ remote_user@remote_host:/absolute_path_to_remote_dir/ if [ $? -ne 0 ] ; then echo "Something went wrong: don't delete local files." else rm -r local_dir/ fi </code></pre> <p>The options are as follows (for more info, see, e.g., <a href="http://ss64.com/bash/rsync.html" rel="nofollow">http://ss64.com/bash/rsync.html</a>):</p> <pre> -a, --archive Archive mode -z, --compress Compress file data during the transfer -r, --recursive recurse into directories -p, --perms Preserve permissions --progress Show progress during transfer --password-file=FILE Get password from FILE <strike>--delete-after Receiver deletes after transfer, not during</strike> </pre> <p><em><strong>Edit: removed --delete-after, since that's not the OP's intent</em></strong></p> <p>Be careful when setting the permissions for the file containing the password. Ideally only you should have access tot he file.</p> <p>As usual, I'd recommend to play a bit with rsync in order to get familiar with it. It is best to check the return value of rsync (using $?) before deleting the local files. </p> <p>More information about rsync: <a href="http://linux.about.com/library/cmd/blcmdl1_rsync.htm" rel="nofollow">http://linux.about.com/library/cmd/blcmdl1_rsync.htm</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload