#!/bin/bash inotifywait -rm -e CLOSE_WRITE /root | while read file; do file_full_name=`echo "$file" | awk '{print $1$3}'` file_path=`echo "$file" | awk '{print $1}'` file_path_count=`echo "$file_path" | tr -cd '/' | wc -c` if [ -f $file_full_name -a $file_path_count = 4 ]; then file_ext_name=`echo ${file:0-3:3}` if [ $file_ext_name = "zip" ]; then echo "--------------------------------" >> /home/lxp/my_shell/log/log_auto_extract echo "--------------------------------" >> /home/lxp/my_shell/log/log_auto_extract date +"%Y-%m-%d %H:%M:%S" >> /home/lxp/my_shell/log/log_auto_extract unzip -o $file_full_name -d $file_path >> /home/lxp/my_shell/log/log_auto_extract 2>&1 fi fi done
文件自动解压
猜你喜欢
转载自luoxiaoping-com.iteye.com/blog/1104511
今日推荐
周排行