六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 20|回复: 0

文件自动解压

[复制链接]

升级  30%

3

主题

3

主题

3

主题

童生

Rank: 1

积分
15
 楼主| 发表于 2013-2-1 09:48:54 | 显示全部楼层 |阅读模式
#!/bin/bashinotifywait -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       fidone
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表