Public feed #890043

Untitled

public text v1 · immutable
Raw Edit
·published 2008-02-03 12:20 UTC
rendered paste body
#!/bin/bash

#set -x;

recursive()
{
    ls -1 "$1" | while read file
    do
    local tmpFullPath="$1/$file"
    local tmpDownloaded="$StartDirectory/$DownloadedDir${tmpFullPath##$StartDirectory/$ToDownloadDir}"
        if [ -d "$tmpFullPath" ] ; then 
            mkdir "$tmpDownloaded"
            recursive "$tmpFullPath" "$tmpDownloaded"
        else
            local tmpOldDir=`pwd`
            local tmpParams=`cat "$tmpFullPath"`
            cd "$2"
            `$CommandToEx $tmpParams`
            cd "$tmpOldDir"
        fi
    done
}

StartDirectory="/home/download"
cd "$StartDirectory"
ToDownloadDir=".ToDownload"
DownloadedDir=".Downloaded"
CommandToEx="echo wget --continue --recursive --limit-rate=2k "
while [ true ]; do
    recursive "$StartDirectory/$ToDownloadDir" "$StartDirectory/$DownloadedDir"
    echo "All Done... Sleep"
    sleep 600
done