I want to remote directory to local directory.script works properly but I have face some issue every time SCP update all files. My use case only updated file is copy the remote directory to local directory. if any bash gem helps appreciated your efforts. The source code is attachedenter image description here.
Asked
Active
Viewed 169 times
0
Local Directory for backups. A date-specific folder is created under this directory for the files.
LD=/home/ec2-user/newFolder
Remote Directory to retrieve. Files are retrieved recursively starting here. Hidden files are included.
Must be full path, don't use ~ shortcut.
RD=/home/ec2-user/new
Path to SSH ID file (private key)
ID=~/.ssh/id_rsa
DATE=$(date '+%Y-%m-%d %H:%M:%S')
USERname to login as
USER=user-name
HOST to login to
HOST=host-name #--- end config
BD="$LD/$DATE" mkdir $BD scp -ri $ID $USER@$HOST:$RD $BD
– Farhan Hameed Oct 19 '20 at 09:22