linux文件循环备份,linux下的文件备份(未完待续)

#/usr/bin/bsh

path_file_list="/home/zwh/backup/"

fn_file_list="$path_file_list/file_list"

fn_file_list_tmp="$path_file_list/file_list_tmp"

fn_md5_file_list="$path_file_list/md5_list"

#替换配置路径中的日期格式

replace_date()

{

$file=$1

cat $file | while read line

do

if [ ]; then

day=`echo "$path" | awk -F"%" '{print $1;}'`

day=`date %Y%m%d -d '-$day day'`

path=`echo "$path" | sed s/%YMD-\d+%/$day/ `

fi

echo "$path" >> $newconf

done

}

#替换软链接文件

replace_symbolic_link()

{

input_path=$1

output_path=$2

find "$input_path" -type l -exec file '{}' \; | awk -F": symbolic link to \`" '{ if( match("^/*$",$2) ==0 ){print $2;} }' >> "$output_path"

}

create_file_list()

{

path_tmp="$fn_file_list_tmp".tmp

# 获取所有文件列表

find "$path_file_list" -type f > "$path_tmp"

# 获取所有软链接文件列表

replace_symbolic_link "$path_file_list" "$path_tmp"

# 排序

cat "$path_tmp" | sort > "$fn_file_list_tmp"

rm -f "$path_tmp"

# 生成MD5值

cat "$fn_file_list_tmp" | xargs md5sum >> "$fn_md5_file_list"

}

repalce_date $1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值