* * * * * ssh user@server1 "mkdir -p /root/Documents/folder_$(date +%d-%m-%y)" && scp /root/Documents/tryfile user@server2:/root/Documents/folder_$(date +%d-%m-%y)**
Using the above syntax I will make a directory in
server1 with today's date and then copy the files to
sever2 for the recently created directory with date. and I am trying to schedule this shell script code in cron tab.which will run on every day at 9 clock night.
Files that I am having in the
server1 is huge it will take more than 5 hours.whether the files will copy to the directory or it will end up with no directory found because at the midnight the date will change and obviously in my syntax of SCP I have mentioned my target directory with date.