#!/bin/sh
logs_dir=/oracle/weblogic/user_projects/domains/webdomain/log4j
cd ${logs_dir}for file in `ls *.log.*`doapp=${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 posted on 2013-03-27 16:49 阅读( ...) 评论( ...)