当前位置:网站首页>更改当前文件夹及文件夹下文件日期shell脚本
更改当前文件夹及文件夹下文件日期shell脚本
2022-07-07 05:52:00 【陈哆肉&J】
#!/bin/bash
function changeName(){
#new=`echo $1|sed 's/^/abc/g'`
#new=`echo $1|sed -r 's/abc(.*$)/\1/g'`
new=`echo $1|sed -r 's/20220630/20220707/g'`
##以602结尾的进行替换
new1=`echo $1|sed -r 's/630$/707/g'`
##以0601.DBF类似的文件进行替换
new2=`echo $1|sed 's/0630/0707/g'`
echo changeName old: $1 new: $new
if [ $1 != $new ];then
mv $1 $new
fi
echo changeName old: $1 new: $new1
if [ $1 != $new1 ];then
mv $1 $new1
fi
echo changeName old: $1 new: $new2
if [ $1 != $new2 ];then
mv $1 $new2
fi
}
function travFolder(){
#echo "travFolder start"
flist=`ls $1`
cd $1
for f in $flist
do
#echo traverse do $f
local old=$f
if test -d $f
then
#echo "traverse dir:${f}"
travFolder $f
#echo "traverse rename dir:${f}"
changeName $old #新加的rename文件夹名字
else
#echo "traverse file:$f"
changeName $f
fi
done
cd ../
}
param=$1
if [ -z "$1" ]
then
param="./20220707"
echo "empty string: $param"
else
param=$1
fi
cp -r ./20220630 ./20220707
travFolder $param
保存为 changedate.sh文件
命令执行
sh changedate.sh
边栏推荐
- 单场带货涨粉10万,农村主播竟将男装卖爆单?
- Opencv learning notes 1 -- several methods of reading images
- Novice entry SCM must understand those things
- 一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
- Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月6日-新手快速上手-可无缝升级tp6版本
- 字符串操作
- Calling the creation engine interface of Huawei game multimedia service returns error code 1002, error message: the params is error
- POJ - 3784 Running Median(对顶堆)
- Golang compilation constraint / conditional compilation (/ / +build < tags>)
- 归并排序和非比较排序
猜你喜欢
2-3查找樹
Explore creativity in steam art design
联想混合云Lenovo xCloud:4大产品线+IT服务门户
In go language, function is a type
Merge sort and non comparison sort
如何在HarmonyOS应用中集成App Linking服务
Virtual address space
Splunk query CSV lookup table data dynamic query
Compilation and linking of programs
Iptables' state module (FTP service exercise)
随机推荐
Download and install orcale database11.2.0.4
Thirteen forms of lambda in kotlin
下载和安装orcale database11.2.0.4
A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
Practice of combining rook CEPH and rainbow, a cloud native storage solution
Snyk 依赖性安全漏洞扫描工具
GFS分布式文件系统
DeiT学习笔记
One click installation of highly available Nacos clusters in rainbow
【无标题】
说一个软件创业项目,有谁愿意投资的吗?
POJ - 3616 Milking Time(DP+LIS)
Le système mes est un choix nécessaire pour la production de l'entreprise
Caractéristiques de bisenet
Data type - floating point (C language)
联想混合云Lenovo xCloud:4大产品线+IT服务门户
Pvtv2--pyramid vision transformer V2 learning notes
go写一个在一定时间内运行的程序
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
Several ways of lambda used in functions in kotlin (higher-order functions)