当前位置:网站首页>shell小技巧(一百三十五)打包指定目录下所用文件,每个文件单独打包
shell小技巧(一百三十五)打包指定目录下所用文件,每个文件单独打包
2022-08-10 20:47:00 【乐大师】
#!/bin/bash
if [ -z $1 ]; then
echo "please input directory"
exit 2
fi
if [ -d $1 ]; then
cd $1
else
echo "Then directory error!"
exit 1
fi
for i in `ls`
do
tar cfz $i.gz $i
done
运行脚本,需要指定一个目录作为参数。脚本将会对该目录下所有文件单独打包。
边栏推荐
- 单选点击可取消功能
- 【网络通信四】ping工具源码cmake工程编译以及运行说明
- PostgreSQL — 安装及常用命令
- 通用线程:POSIX 线程详解,第 2部分
- 1D Array Dynamics and Question Answers
- 如何提交一个PR?【OpenHarmony成长计划】【OpenHarmony开源社区】
- 内置模板市场,DataEase开源数据可视化分析平台v1.13.0发布
- C语言详解系列——关于调试那些事
- Tf ferritin particles contain cisplatin / oxaliplatin / doxorubicin / methotrexate MTX / paclitaxel PTX and other drugs
- 睡前故事|用Bitmap与AST做一个配置化时长系统
猜你喜欢
【语义分割】2015-UNet MICCAI
【图像分类】2019-MoblieNetV3 ICCV
Kerberos认证
【图像分类】2018-MobileNetV2
双 TL431 级联振荡器
TortoiseSVN小乌龟的使用
Apple Font Lookup
(10) Sequence and deserialization of image data
机器学习笔记:t-SNE
- [email prot"/>
Transferrin-modified osthole long-circulating liposomes/PEG-PLGA nanoparticles loaded with notoginsenoside R1 ([email prot
随机推荐
图扑智慧电力可视化大屏,赋能虚拟电厂精准减碳
Floating window in Auto.js
[SemiDrive source code analysis] [MailBox inter-core communication] 52 - DCF Notify implementation principle analysis and code combat
【语义分割】2015-UNet MICCAI
Knowledge map Knowledge Graph
C 语言 时间函数使用技巧(汇总)
知识图谱Knowledge Graph
Before implementing MES management system, these three questions to consider
社区分享|货拉拉通过JumpServer纳管大规模云上资产
Web3中值得关注的基础设施
APP application related instructions in Auto.js
CMU博士论文 | 视频多模态学习:探索模型和任务复杂性
Auto.js中APP应用相关指令
Rider调试ASP.NET Core时报thread not gc-safe的解决方法
sklearn 笔记 TSNE
【ACM】dp专场训练
Detailed explanation and use of each module of ansible
金鱼哥RHCA回忆录:CL210OpenStack操作的故障排除--章节实验
爬虫基本原理介绍、实现以及问题解决
The most complete GIS related software in history (CAD, FME, ArcGIS, ArcGISPro)