shell 遍历
2024-09-26 05:41:25
for file in $1/*
do
if [ -f $file ]
then
SUFFIX=${file#*BK}
PREFIX=${SUFFIX%%_*}
CURRENT=`date -d -7day +%Y%m%d`
if [[ $CURRENT -gt $PREFIX ]]
then
rm -rf $file
fi
fi
done
#!bin/sh
for file in ./*
do
if test -f $file
then
echo $file 是文件
fi
if test -d $file
then
echo $file 是目录
fi
done
if --else 类型: #!bin/sh
for file in ./*
do
if test -f $file
then
echo $file 是文件
else
echo $file 是目录
fi
done
最新文章
- iOS and JAVA 的 RSA 加密解密 (转载整理 )
- mysql 存储引擎
- 关于CSS三列Float布局任务
- redis-cluster 单个节点不可用
- serialVersionUID的作用
- 调用MyFocus库,简单实现二十几种轮播效果
- Swift3.0语言教程比较、判断字符串
- DependencyProperties or INotifyPropertyChanged ?
- Dedecms最新版本存储型XSS
- Python字典笔记
- dev中gridview控件 z
- jQuery停止事件冒泡
- innerhtml和innertext的用法以及区别
- android adb 不同的方式使用特定的解释
- sqoop: mysql to hive
- xssgame挑战wp
- 《java入门第一季》之面向对象(private关键字与封装概念的初探)
- 前端css
- Mysql 字符串分隔函数
- Unbuntu 16.04 英文环境安装中文输入法