Mark a record auto-upload script.

#!/bin/bash
dir="/home/Record/Save"

while :
do
    for file in ${dir}/*.flv
    do
        if [[ -f "${file}" ]]; then
            isOpen=`lsof "${file}"`

            if [[ -z "${isOpen}" ]]; then
                echo "${file}" is not open
                if [[ -z $(BaiduPCS-Go ls /Record/`date -d "6 hour ago" +"%Y-%m-%d"`/ | grep "文件或目录不存在") ]]; then
                    if [[ $(find "${file}" -type f -size +102400c 2>/dev/null) ]]; then
                        /usr/bin/ffmpeg -i "${file}" -vcodec copy -acodec copy "${file%.flv}.mp4" && rm -rf "${file}"
                        /usr/bin/BaiduPCS-Go u --nofix "${file%.flv}.mp4" /Record/`date -d "6 hour ago" +"%Y-%m-%d"`/ && rm -rf "${file%.flv}.mp4"
                    else
                        echo Delete trash file "${file}".
                        rm -rf "${file}"
                    fi
                else
                    /usr/bin/BaiduPCS-Go mkdir /Record/`date -d "6 hour ago" +"%Y-%m-%d"`
                fi
            fi
        fi
    done
    sleep 10
done

测试下b站图
鸭类鸭类

Last modification:January 12, 2020
(๑´ڡ`๑)