当前位置:网站首页>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
边栏推荐
- [Chongqing Guangdong education] organic electronics (Bilingual) reference materials of Nanjing University of Posts and Telecommunications
- Implementation of navigation bar at the bottom of applet
- 说一个软件创业项目,有谁愿意投资的吗?
- Componentspace2022, assertions, protocols, bindings, and configuration files
- The single value view in Splunk uses to replace numeric values with text
- What is the method of manual wiring in PCB design in 22protel DXP_ Chengdu electromechanical Development Undertaking
- 调用华为游戏多媒体服务的创建引擎接口返回错误码1002,错误信息:the params is error
- [南京大学]-[软件分析]课程学习笔记(一)-introduction
- Qt Charts使用(重写QChartView,实现一些自定义功能)
- Golang compilation constraint / conditional compilation (/ / +build < tags>)
猜你喜欢
SSM integration
Laravel8 uses passport login and JWT (generate token)
Train your dataset with swinunet
2-3查找树
Count sort (diagram)
南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案
Compilation and linking of programs
Interpolation lookup (two methods)
Iptables' state module (FTP service exercise)
Analysis of using jsonp cross domain vulnerability and XSS vulnerability in honeypot
随机推荐
Greenplum6.x常用语句
Opencv learning notes II - basic image operations
JEditableTable的使用技巧
Leetcode 1984. Minimum difference in student scores
Analysis of using jsonp cross domain vulnerability and XSS vulnerability in honeypot
National SMS center number inquiry
[untitled]
如何在快应用中实现滑动操作组件
Ebpf cilium practice (1) - team based network isolation
Upload an e-office V9 arbitrary file [vulnerability recurrence practice]
[Yugong series] February 2022 U3D full stack class 006 unity toolbar
A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
JS的操作
如何理解分布式架构和微服务架构呢
Teach you how to select PCB board by hand (II)
MES系统,是企业生产的必要选择
数据分析方法论与前人经验总结2【笔记干货】
Golan idea IntelliJ cannot input Chinese characters
oracle一次性说清楚,多种分隔符的一个字段拆分多行,再多行多列多种分隔符拆多行,最终处理超亿亿。。亿级别数据量
opencv之图像分割