当前位置:网站首页>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 $paramSave as changedate.sh file
Command execution
sh changedate.sh边栏推荐
- [南京大学]-[软件分析]课程学习笔记(一)-introduction
- A method for quickly viewing pod logs under frequent tests (grep awk xargs kuberctl)
- IP地址的类别
- GOLand idea intellij 无法输入汉字
- Golang compilation constraint / conditional compilation (/ / +build < tags>)
- Xcit learning notes
- Golan idea IntelliJ cannot input Chinese characters
- IP guard helps energy enterprises improve terminal anti disclosure measures to protect the security of confidential information
- SSM 整合
- 如何在HarmonyOS应用中集成App Linking服务
猜你喜欢

Xcit learning notes

Rainbow combines neuvector to practice container safety management

Data type - floating point (C language)

南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案

Greenplum6.x重新初始化

All about PDF crack, a complete solution to meet all your PDF needs

How to integrate app linking services in harmonyos applications

详解华为应用市场2022年逐步减少32位包体上架应用和策略

路由信息协议——RIP
![[Yugong series] February 2022 U3D full stack class 005 unity engine view](/img/19/dc1b2f74b9ec5f5808de3049793862.jpg)
[Yugong series] February 2022 U3D full stack class 005 unity engine view
随机推荐
Rainbow combines neuvector to practice container safety management
Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月6日-新手快速上手-可无缝升级tp6版本
Input of mathematical formula of obsidan
Virtual address space
Opencv learning notes II - basic image operations
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
Greenplum6.x常用语句
[Chongqing Guangdong education] accounting reference materials of Nanjing University of Information Engineering
Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
Opencv learning note 3 - image smoothing / denoising
快速集成认证服务-HarmonyOS平台
MES系统,是企业生产的必要选择
调用华为游戏多媒体服务的创建引擎接口返回错误码1002,错误信息:the params is error
Arm GIC (IV) GIC V3 register class analysis notes.
FPGA knowledge accumulation [6]
Tuowei information uses the cloud native landing practice of rainbow
Rapid integration of authentication services - harmonyos platform
National SMS center number inquiry
POJ - 3616 Milking Time(DP+LIS)
如何在快应用中实现滑动操作组件