add func file_size + del unused func

This commit is contained in:
6543 2019-05-11 19:11:37 +02:00
parent cecbdd9050
commit 7931150ca2

View File

@ -142,16 +142,13 @@ function db_query() {
echo $@ | mysql $args echo $@ | mysql $args
} }


# db_exist_md5 <md5> -> true/false 0/1 # file_size <path> -> (du -b)/1024 [Kb]
function db_exist_md5() { function file_size() {
result=($(db_query "SELECT COUNT(md5) FROM File WHERE File.MD5 LIKE '$1';")) if [ -f "$1" ]; then
if [ "${result[2]}" -gt "0" ]; then echo $(($(du -b "$1" | cut -f 1)/1024))
echo true else
return $TRUE echo 0
else fi
echo false
return $FALSE
fi
} }


case "$mode" in case "$mode" in