当前位置:网站首页>更改当前文件夹及文件夹下文件日期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边栏推荐
- IP-guard助力能源企业完善终端防泄密措施,保护机密资料安全
- Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月6日-新手快速上手-可无缝升级tp6版本
- You should use Google related products with caution
- 关于基于kangle和EP面板使用CDN
- 测试踩坑 - 当已有接口(或数据库表中)新增字段时,都需要注意哪些测试点?
- Opencv learning notes II - basic image operations
- One click installation of highly available Nacos clusters in rainbow
- 2-3 lookup tree
- Implement your own dataset using bisenet
- POJ - 3784 Running Median(对顶堆)
猜你喜欢

Practice of implementing cloud native Devops based on rainbow library app

Data type - integer (C language)

如何在HarmonyOS应用中集成App Linking服务

Through the "last mile" of legal services for the masses, fangzheng Puhua labor and personnel law self-service consulting service platform has been frequently "praised"

Opencv learning notes II - basic image operations

XCiT学习笔记

How to realize the high temperature alarm of the machine room in the moving ring monitoring system

2 - 3 arbre de recherche

数据分析方法论与前人经验总结2【笔记干货】

Xcit learning notes
随机推荐
Give full play to the wide practicality of maker education space
go写一个在一定时间内运行的程序
Composer change domestic image
AVL平衡二叉搜索树
归并排序和非比较排序
Implementation method of data platform landing
接口作为参数(接口回调)
MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
Explore creativity in steam art design
Merge sort and non comparison sort
Go语言中,函数是一种类型
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
国标GB28181协议视频平台EasyGBS新增拉流超时配置
[machine learning] watermelon book data set_ data sharing
Splunk query CSV lookup table data dynamic query
Grpc, oauth2, OpenSSL, two-way authentication, one-way authentication and other column directories
JEditableTable的使用技巧
Installation and configuration of PLSQL
ES6_ Arrow function
Opencv learning note 4 - expansion / corrosion / open operation / close operation