#!/bin/sh
logs_dir=/oracle/weblogic/user_projects/domains/webdomain/log4j
cd ${logs_dir}
for file in `ls *.log.*`
do
app=${file%%.log.20*}
dt=${file##*.log.}
dy=${dt:0:4}
dm=${dt:5:2}
dd=${dt:8:2}
target_dir=${logs_dir}/${app}/${dy}/${dm}/${dd}/
if [ ! -d ${target_dir} ];
then
/bin/mkdir -p ${target_dir}
#echo $target_dir' is not exists'
fi
#echo ${file}
sfile=${logs_dir}/${file}
#echo ${sfile}
/bin/mv ${sfile} ${target_dir}
#echo 'sfile='${sfile}' target_dir='${target_dir}
done