linux通过if判断是否压缩文件和文件夹
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
#!/bin/sh
bakPath="/usr/local/upload_backup/"
echo "bakPath is $bakPath"
filePathName=`date +%Y_%m_%d`
echo "filePathName is $filePathName"
fileName=pics_`date +%Y_%m_%d.tar`
echo "fileNameis $fileName/fileName "
echo " $bakPath$filePathName/$fileName "
sourceDir="/usr/local/upload"
echo "fsourceDir is $sourceDir "
BACKUP_DIR="/usr/local/"
echo "{BACKUP_DIR} is ${BACKUP_DIR} "
if [ ! -d "$bakPath" ]; then
echo "/usr/local/upload_backup"
mkdir "$bakPath"
echo "$bakPath文件夹创建成功"
else
echo "$bakPath文件夹已经存在"
fi
if [ ! -d "$bakPath`date +%Y_%m_%d`" ]; then
echo "/usr/local/upload_backup"
mkdir "$bakPath`date +%Y_%m_%d`"
echo "$filePathName文件夹成功"
else
echo "$filePathName文件夹已经存在"
fi
cd ${BACKUP_DIR}
BAK_FLAG=0
checkRead(){
if [ $MAX_NO -ne 0 -a $MAX_NO -ne 1 ] ; then
actionRead
fi
}
actionRead(){
echo -n "是否备份已上传图片?是请输入1;否请输入0 "
read MAX_NO
checkRead
}
actionRead
if [ $MAX_NO -eq 1 ] ; then
tar -czvPf $bakPath$filePathName/$fileName $sourceDir
fi
bakPath="/usr/local/upload_backup/"
echo "bakPath is $bakPath"
filePathName=`date +%Y_%m_%d`
echo "filePathName is $filePathName"
fileName=pics_`date +%Y_%m_%d.tar`
echo "fileNameis $fileName/fileName "
echo " $bakPath$filePathName/$fileName "
sourceDir="/usr/local/upload"
echo "fsourceDir is $sourceDir "
BACKUP_DIR="/usr/local/"
echo "{BACKUP_DIR} is ${BACKUP_DIR} "
if [ ! -d "$bakPath" ]; then
echo "/usr/local/upload_backup"
mkdir "$bakPath"
echo "$bakPath文件夹创建成功"
else
echo "$bakPath文件夹已经存在"
fi
if [ ! -d "$bakPath`date +%Y_%m_%d`" ]; then
echo "/usr/local/upload_backup"
mkdir "$bakPath`date +%Y_%m_%d`"
echo "$filePathName文件夹成功"
else
echo "$filePathName文件夹已经存在"
fi
cd ${BACKUP_DIR}
BAK_FLAG=0
checkRead(){
if [ $MAX_NO -ne 0 -a $MAX_NO -ne 1 ] ; then
actionRead
fi
}
actionRead(){
echo -n "是否备份已上传图片?是请输入1;否请输入0 "
read MAX_NO
checkRead
}
actionRead
if [ $MAX_NO -eq 1 ] ; then
tar -czvPf $bakPath$filePathName/$fileName $sourceDir
fi
http://www.cnblogs.com/qq78292959/archive/2011/07/06/2099427.html tar指令解释
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献4条内容
所有评论(0)