|
CentOS Linux release 7.8
Hello Erman,
I have created a bash script to copy files from 1 directory /archive to another directory voicenew. After copy, I will unzip the files.
The issue is if I store the current date in a variable (yesterday), the variable will store sysdate+1. For e.g, if today is 24, I will get error below
cp: cannot stat ‘/cdr/RECHARGE/recharge/archive/recharge/archive/*20210325*’: No such file or directory
Script:
cd /cdr/VOICE/VOICE/voice/voicenew/
find . -name "*.add" -print0 | xargs -0 rm
find . -name "*.gz" -print0 | xargs -0 rm
yesterday=$(date -d "$date days" +"%Y%m%d")
cp /cdr/VOICE/VOICE/voice/archive/voice/archive/*$yesterday* /cdr/VOICE/VOICE/voice/voicenew/
y| find /cdr/VOICE/VOICE/voice/voicenew/ -type f -exec gunzip {} +
Kindly advise.
Thanks,
Roshan
|