• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >perl > 服务器自动删除文件的脚本

服务器自动删除文件的脚本

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了服务器脚本,服务器端脚本语言,服务器脚本语言,samp服务器脚本,我的世界服务器脚本等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

支持匹配路径 匹配文件名  多久没有访问的自动清理

if [ $# -eq 0 ];then
    echo "Usage: sh auto_clear_file.sh clear_filepath clear_regfilename filecreatetime"
    echo "eg: sh auto_clear_file.sh /tmp/log/  user_log -7day"
    exit
fi

filepath=$1
regfilename=$2


if [ "-$3" = "-" ];then
    filectime=`date -d -7day '+ %s'`
else
    filectime=`date -d $3 '+ %s'`
fi

log=`ls $filepath | grep $regfilename`
echo $log

for file in ${log}
do
    echo $file
    fileatime=`stat -c %X ${filepath}${file}`

    if [ ${fileatime} -lt ${filectime} ]; then
        opt=`rm -f ${filepath}${file}`
        echo $opt
    fi 
done
</div>

</div>

您可能想查找下面的文章:

  • 服务器自动删除文件的脚本

相关文章

  • perl中使用ip138网站查询ip归属地脚本分享
  • Perl List::Util模块使用实例
  • 使用perl实现拆分数据表(mysql)并迁移数据实例
  • 用Perl操作Excel文档的实例代码
  • perl文件包含(do,require,use)指令介绍
  • perl去除重复内容的脚本代码(重复行+数组重复字段)
  • Perl函数(子程序)学习笔记
  • 冒充su ,perl写的su.pl盗取root密码
  • 有关perl正则表达式的一些杂项
  • 在vim中添加perl注释时无法对齐问题的解决方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • perl处理xml的模块介绍
    • 不错的一篇学习CGI脚本(脚本)
    • perl的cgi高级编程介绍
    • perl 文件操作总结
    • Perl 文本文件的读写操作、文件的重命名和删除、多个文本文件的合并实现代码
    • perl面向对象实例
    • perl 删除数组元素的几种方法小结
    • PERL脚本 学习笔记
    • perl 采集入库脚本分享
    • perl 模块打包加入外部依赖程序

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有