I am trying to copy the files modified from specific date to current date from Source server to target server with same directory structure. I have created the script for copying files from Source directory to target directory in same server. Now looking for 2 different Linux servers.
Source server: Source34.abc.net
Directory and files: /home/Amal/db/tmp/File1.txt, /home/Amal/db/work/File2.txt, /home/Amal/db/out.xml
Target Server: Target30.efg.net
Directory : /home/Amal/db/tmp/ /home/Amal/db/work/
Want to achieve:
- Sftp from source server to Target server
- Copy the files from source to Target with the same folder structure
NOTE: Source and Target will have same Directory structure
51 Answer
Probably the most easiest way to use scp through ssh.
Open terminal in source system and type in the command below
scp <source-directory> -i <path-to-ssh-key> <ipaddress-of-target>@<user>:<target-directory>