当前位置:网站首页>Shell script for changing the current folder and the file date under the folder
Shell script for changing the current folder and the file date under the folder
2022-07-07 08:42:00 【Chen duo meat & 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'`
## With 602 Replace at the end
new1=`echo $1|sed -r 's/630$/707/g'`
## With 0601.DBF Replace similar files
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 # Newly added rename Folder name
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
Save as changedate.sh file
Command execution
sh changedate.sh
边栏推荐
- 说一个软件创业项目,有谁愿意投资的吗?
- 使用AGC重签名服务前后渠道号信息异常分析
- Pvtv2--pyramid vision transformer V2 learning notes
- Opencv learning notes 1 -- several methods of reading images
- Go语言中,函数是一种类型
- About using CDN based on Kangle and EP panel
- Golang compilation constraint / conditional compilation (/ / +build < tags>)
- How to integrate app linking services in harmonyos applications
- [Chongqing Guangdong education] audio visual language reference materials of Xinyang Normal University
- iptables 之 state模块(ftp服务练习)
猜你喜欢
opencv之图像分割
打通法律服务群众“最后一公里”,方正璞华劳动人事法律自助咨询服务平台频获“点赞”
Rsync remote synchronization
Analysis of using jsonp cross domain vulnerability and XSS vulnerability in honeypot
Pvtv2--pyramid vision transformer V2 learning notes
MySQL introduction - crud Foundation (establishment of the prototype of the idea of adding, deleting, changing and searching)
Low success rate of unit test report
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
Are you holding back on the publicity of the salary system for it posts such as testing, development, operation and maintenance?
A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
随机推荐
2 - 3 arbre de recherche
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
[Yu Yue education] basic reference materials of electrical and electronic technology of Nanjing Institute of information technology
You should use Google related products with caution
Greenplum6.x常用语句
Xcit learning notes
Gson转换实体类为json时报declares multiple JSON fields named
Composer change domestic image
[machine learning] watermelon book data set_ data sharing
Arm GIC (IV) GIC V3 register class analysis notes.
联想混合云Lenovo xCloud:4大产品线+IT服务门户
[Yugong series] February 2022 U3D full stack class 005 unity engine view
GFS distributed file system
A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
数据分片介绍
路由信息协议——RIP
grpc、oauth2、openssl、双向认证、单向认证等专栏文章目录
Go write a program that runs within a certain period of time
归并排序和非比较排序
opencv之图像分割