LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-10-2009, 03:02 AM   #1
ralcocer
LQ Newbie
 
Registered: Sep 2006
Posts: 4

Rep: Reputation: 1
Downloading a list of files from a remote server using a list


I am trying to get this script to work.
The purpose is to download a list of modules from the slax.org
the list consist of a list of module numbers.
What I am trying to do is Download the file or the file name corresponding to the number in the list.the list is comma delimited.
this is what I have done so far and I am a stand still.

#!/bin/sh

# Wget script to retrieve modules from slax.org modules

#

# ----Begin of user defined values -----

# Path to wget
WGETPATH="/usr/bin"
list_file="/tmp/build.txt"
# modules list file
HLIST="/tmp/build.txt"

#

# output directory
# DOWNLOADIR="/tmp/download
DOWNLOADIR="/tmp/download"



LOGFILE=wgetmodulelog-`date +%m-%d-%y-%H:%M`.log


# Verify download directory exists.
if [ ! -d $DOWNLOADIR ];then
echo ""
echo "$DOWNLOADIR download directory does not exist."
echo "Please create directory $DOWNLOADIR."
exit
fi





for line in `cat ${HLIST}`;do

echo "line" $line

echo "Downloading " ${line}
echo ""#


${WGETPATH}/wget -v "http://www.slax.org/modules/${line}/dl/" ${DOWNLOADIR}/${line} >> ${LOGFILE} 2>&1

done

# "http://www.slax.org/modules.php?action=detail&id=2163" from here to
#http://www.slax.org/modules/2163/ndiswarapper.lzm here

#########################################################
Thanks for your help

Rafael Alcocer
Linux user # 458372
To follow the path:
look to the master,
follow the master,
walk with the master,
see through the master,
become the master.
 
Old 02-11-2009, 12:36 PM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Bash splits only spaces, not commas. Try `cat ${HLIST} | sed -e 's/,/ /g'`
 
Old 02-11-2009, 01:02 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
You haven't exactly explained what part is failing. Can you be more specific about what you need help with?
Here is a snippet of shell script that does the essence of what you seem to be trying:
Code:
cd $DOWNLOADDIR
while read url; 
do 
    wget http://www.slax.org/modules/${url}/dl/; 
done < /tmp/build.txt
(Note how much mode readable code is, when posted in [CODE] tags).

--- rod.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to list all files recursively, in a non-broken list? nyle Linux - Newbie 1 12-16-2008 10:52 PM
adding proc list and task list of active processes. pravin.embedded Linux - Newbie 1 09-02-2008 01:20 PM
Is there a list on the web similar to the Hardware Compatibilty List for Windows ? andhrooy Linux - Newbie 2 08-10-2008 09:06 AM
List users logged in to remote system jantman Linux - Software 3 12-11-2006 12:01 AM
Problem - Cannot fetch remote server list AndrewMSConvert Suse/Novell 7 10-14-2005 11:18 PM


All times are GMT -5. The time now is 07:06 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration