aliyun OOS resource synchronization [ossutil]

#! / bin / bash #Synchronize 
remote pictures to OSS Bucket 
# @ author <lixiuran> 
# https://help.aliyun.com/document_detail/120069.html?spm=a2c4g.11186623.6.704.63e424bcZQvfKY
SRC_DIR = $ ( pwd ) " / src " echo " SRC DIR: " $ {SRC_DIR} mkdir - p $ {SRC_DIR} for i in ` cat ./public.txt | awk ' {print $ NF} ' | grep ' \. ' | grep ' Contract ' `; do # echo $ i | awk -F ' / ' ' {print $ NF} ' echo " Create directory: " $ {i% / * } echo "Current file:" $ i mkdir -p $ {SRC_DIR} "/" $ {i% / *} if [-f $ {SRC_DIR} "/" $ {i}]; then echo "File already exists" else #download if it does not exist wget -P $ {SRC_DIR} "/" $ {i% / *} " http://www.xxx.com/ " $ i fi SUB_NAME = $ {i / Public /} echo $ SUB_NAME ./ossutilmac64 appendfromfile ${SRC_DIR}"/"$i "oss://cdn-test"${SUB_NAME} if [ $? -ne 0 ]; then echo "failed" exit else echo "succeed" fi done

 

public.txt is a resource file (get the list of files modified in the last day by find ./Public -ctime -1 -ls)

 

 

 

Guess you like

Origin www.cnblogs.com/lixiuran/p/12716211.html