one days earliear than today with date

today, after christmas, i have a job, copying backup folder to surabaya. My backup format is dir-name-YYYY-MM-DD, and i want to copy all of file in that directory one day earliear from the current date. So, how i do that task ? after reading man pages of date, i’ve got a clue, here it is :

to get 1 day earlier than today, run this command :

date -v-1d +%Y-%m-%d

on my directory format (dir-name-YYYY-MM-DD), i run this command :

scp -r dir-name-$(date -v-1d +%Y-%m-%d) user_dest@xxx.xxx.xxx.xxx:/wew/

DONE!!