-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download only new hash files #242
Conversation
Checks the specified directory for previously-downloaded hash files and only downloads new ones, conserving virusshare's bandwidth.
check for existing hashfile downloads
Hey @ktneely, can you base your PR on the development branch? That would be cool. Thanks for your contribution. |
@3c7 I've rebased the PR on |
do | ||
echo $u | ||
wget https://virusshare.com/$u | ||
if [ -e $1/$u ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you've disabled commits for members, I cannot change that line. You have to delete $1/
as the scripts cd
s into the directory before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script does cd
into $1/
, but when I'm checking the file names, the update performs two cut
commands, lopping off the directory assigned to $1
. A little convoluted, but it makes the comparison easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not what I wanted to say. You cut
something off, that's right but it only affects the filename, after that you still have that commands:
cd $1
if [ -e $1/$u ]
That leads to "being in" directory $1
and checks if there's an directory $1
with file $u
in it. Or I'm completely blind and oversee something. :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prior to the cd
, the script cut
s the full path twice, making u
only the file name as pulled from the virusshare website, which it then compares to the filenames in directory $1
.
See, e.g. | cut -d\" -f2 | cut -d\/ -f2
in the update as opposed to only cut -d\" -f2
in the original.
The first cuts down to e.g. "hashes/VirusShare_00049.md5", the second lops off the directory on the hosting server and leaves only e.g. "VirusShare_00049.md5", which is then compared to the filename in $1
.
Modified the download script so it only downloads newly added hash files from virusshare, in order to conserve bandwidth for both sides.