当前位置:网站首页>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
边栏推荐
- National standard gb28181 protocol video platform easygbs adds streaming timeout configuration
- 数据分片介绍
- Download and install orcale database11.2.0.4
- POJ - 3616 Milking Time(DP+LIS)
- Obsidan之数学公式的输入
- POJ - 3784 running medium
- JS的操作
- What is the method of manual wiring in PCB design in 22protel DXP_ Chengdu electromechanical Development Undertaking
- Upload an e-office V9 arbitrary file [vulnerability recurrence practice]
- [Yu Yue education] higher vocational English reference materials of Nanjing Polytechnic University
猜你喜欢
数据分片介绍
Practice of combining rook CEPH and rainbow, a cloud native storage solution
Calling the creation engine interface of Huawei game multimedia service returns error code 1002, error message: the params is error
快速集成认证服务-HarmonyOS平台
iptables 之 state模块(ftp服务练习)
How to integrate app linking services in harmonyos applications
Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
指针进阶,字符串函数
AVL balanced binary search tree
随机推荐
Implement your own dataset using bisenet
[machine learning] watermelon book data set_ data sharing
Data type - floating point (C language)
Merge sort and non comparison sort
Three series of BOM elements
調用華為遊戲多媒體服務的創建引擎接口返回錯誤碼1002,錯誤信息:the params is error
Thirteen forms of lambda in kotlin
归并排序和非比较排序
[Yu Yue education] higher vocational English reference materials of Nanjing Polytechnic University
How to understand distributed architecture and micro service architecture
AVL balanced binary search tree
Required String parameter ‘XXX‘ is not present
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"
2-3查找樹
[kuangbin]专题十五 数位DP
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Gson转换实体类为json时报declares multiple JSON fields named
Ebpf cilium practice (2) - underlying network observability
如何在图片的目标中添加目标的mask
leetcode135. Distribute candy