bash script to check for multiple file existence and then scp to another server
I have two logs locations
/opt/apache-tomcat-7.0.34/logs/
/opt/apache-tomcat-7.0.34/another-logs/
Log format in /opt/apache-tomcat-7.0.34/logs/ is
localhost.2014-01-22.log
catalina.2014-01-22.log
catalina-2014-01-22.out
localhost_access_log.2014-01-22.txt
Log format in /opt/apache-tomcat-7.0.34/another-logs/ is
process.2014-01-20.log
qwerty.2014-01-20.log
asdfgh.2014-01-20.log
fgghghgh.2014-01-20.log
ghghghghghghgh.2014-01-20.log
ghghghghg.2014-01-20.log
nbnbnb.2014-01-20.log
currently I have a script to scp all these logs to another server... Now I need to check whether the logs are present if not it should give o/p as 0. If yes it should scp the files....
I tried like
DATE=$(date -d "-1 day" +%Y-%m-%d)
cd /opt/apache-tomcat-7.0.34/logs/
if [[ -f *$DATE* ]]; then
echo "0"
else
echo "1"
But I get 1 as o/p, but files are present......
Is there an way to check for mutliple file existence using multiple wild cards, or is there any other way I can work it out
|