#! /bin/bash
# /root/.config/qb.sh "%D" "%F" "%N"

cloudName=pt
cloudFolder=川川

software=fclone
transfers=4

file="$2"
downloadFolder="$1"
length=${#downloadFolder}
newDownloadFolder=${downloadFolder:0:length-1}
category="${newDownloadFolder##*/}"

echo "file: $file, downloadFolder: $downloadFolder, length: $length, category: $category" > /root/qb.log

if [ -d "${file}" ];then
	${software} copy --transfers=$transfers "$file" "$cloudName:$cloudFolder/$category/$3"
	echo "is File" >> /root/qb.log
elif [ -f "${file}" ]; then
	${software} copy "$file" "$cloudName:$cloudFolder/$category"
	echo "is NOT File" >> /root/qb.log
fi

echo "退出" >> /root/qb.log


exit 0