New answers tagged file-copy
In order to connect to a server via ssh and run a specific command, all you need is ssh "command" In your case, you want to copy a file (it overwrites by default) so you want the cp command. It works like cp /path/to/original /path/to/copy. Now, you said in your comments that trying this gives you a permission denied error. This means that you will ...
Without sudo the command ssh server "cd path/to/directory && cp image1.png image2.png" doesn't have privileges to chmod the permissions. But with sudo it would, but being run after ssh, it never gets password input for it on the remote server, so the solution is use -S and pipe a password for sudo as follows: ssh server " cd path/to/directory ...
ssh host "cd path/to/directory && cp image1.png image2.png" The && is safer than ; in case the cd fails, e.g. because of a typo: in such a case, the cp won't be executed instead of possibly copying a wrong file.
I think the only thing you're missing is to initially include all directories leading to the archive dirs, ie. also --include='*/'. This is because excluding a directory (with '*') excludes everything below it rsync --include='*/' --include='**archive/***' --exclude='*' -avzh /xx/inbound/ /yy/inbound Apart from that, you shouldn't need 2 sets of '-avzh'
It looks OK. Although why are you using the -z option to compress the transfer? This option is normally used when you are copying to a remote rsync server over a slow network. In this instance it will compress and instantly decompress the files which will only increase your CPU uage with no benefit. The -a (archive) option implies the --progress and -r ...
You could do this: http://www.projectik.eu/index.php/programovanie/linux/item/243-linux-kopirovanie-suborov-vo-vlakne Here is example
cp -rfp from_dir to_dir -r - recursive -f - force -p - preserve attributes: mode, ownership, timestamps
Top 50 recent answers are included