Skip to content

Commit

Permalink
auto delete empty downloaded files
Browse files Browse the repository at this point in the history
  • Loading branch information
pan3793 committed Dec 5, 2024
1 parent 8a30441 commit fb43115
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/download.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ source "${SELF_DIR}/.env"
function download_if_not_exists() {
local url=$1
local filename=${url##*/}
if [ ! -s "${SELF_DIR}/download/$filename" ]; then
echo "delete empty $filename ..."
rm -f "${SELF_DIR}/download/$filename"
fi
if [ ! -f "${SELF_DIR}/download/$filename" ]; then
echo "downloading $filename ..."
wget -O "${SELF_DIR}/download/$filename" $url
Expand Down

0 comments on commit fb43115

Please sign in to comment.