0

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:

  1. Sftp from source server to Target server
  2. Copy the files from source to Target with the same folder structure

NOTE: Source and Target will have same Directory structure

5
  • 1
    Do you only have sftp access to both servers? This could be easily accomplished with ssh access to both.
    – Jos
    Sep 23, 2021 at 14:00
  • @Jos - Yes we do have the SSH permissions as well.
    – Amala
    Sep 23, 2021 at 14:58
  • Try rsync as explained here: unix.stackexchange.com/questions/183504/…
    – Jos
    Sep 23, 2021 at 15:07
  • I would anytime choose ssh over sftp. The command you should be looking at is scp Sep 23, 2021 at 15:26
  • @Jos - rsync is not available in our Linux servers. I am trying to connect to source server, Find the files modified or created between 2 dates, And then copy into Target server with the same directory structure.
    – Amala
    Sep 24, 2021 at 6:57

1 Answer 1

0

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>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .