Il primo argomento è il SOURCE il secondo è il DESTINATION(come "cp"). Per chiarezza usare sempre gli argomenti in forma estesa.
mirror criptato su ssh
rsync -v --dry-run --archive --cvs-exclude --compress --force --delete --progress --no-perms --no-owner --no-group --exclude-from=exclude.txt --rsh "ssh -p22" /path/local user@host:/path/remote rsync -v --archive --cvs-exclude --compress --force --delete --stats --rsh "ssh -p22" /path/local/ user@host:/path/remote/
Copy file from a remote server to a local computer
# remote copy rsync --archive --compress /path/local user@host:/path/remote/ rsync -v --rsh ssh user@host:/path/to/local/file.txt /path/to/remote/file.txt
// copia in locale le pagine del wiki remoto
$cmd = "scp -r user@host:/path/remote/* /path/local";
$cmd = "rsync -v --archive --rsh ssh user@srver:/path/remote/* /path/local";
passthru($cmd);
# note the trailing slash rsync --archive /local_path_A/ /local_path_B # local copy rsync -v --archive --one-file-system --executability --delete --ignore-errors /path/local /path/remote
per scaricare files semplice senza algoritmo diff e compressione
$ldir = dirname(__FILE__);
$cmd = "scp -r user@host:/path/local/* /path/local";
synchronizes the directory "F: / my files" on the USB key to the folder :c:\usb"
rsync -r -v --size-only --chmod=ugo=rwX "/cygdrive/f/my file" "/cygdrive/c/usb" // working windows: rsync --dry-run -v --archive --cvs-exclude --compress --stats --progress -h --force --delete --rsh "ssh" /cygdrive/c/x username@host:/var/x
ATTENZIONE: On windows, your exclude-from or include-from file must be in Unix format (newlines rather that cr/lf).
// test for exe in place
$has_rsync = !empty( trim(`which rsync`) );
$has_sshpass = !empty( trim(`which sshpass`) );
// @see project seed
// --no-perms non settare permessi ai file remoti
// --omit-dir-times will avoid it trying to set modification times on directories.
$cmd ="$rsync_cmd $cmd_dry_run -v --archive --cvs-exclude --compress --checksum --stats --progress -h --force --delete $exclude --no-perms --omit-dir-times --rsh \"$ssh_cmd\" $local_path $user@$host:$remote_path";
automatizzare l'immissione della pasword:
$remote_shell = "/usr/bin/sshpass -p $pwd ssh -p22";
$cmd_remote_shell = "--rsh \"$remote_shell\"";// equivale a -e
$cmd = "rsync -v --archive --cvs-exclude --compress --delete --force
--stats --progress --human-readable
--checksum --no-perms --no-owner --no-group
";
$cmd .= " $cmd_remote_shell $local_path/ $user@$host:$remote_path";
echo $cmd;