@slhck provided a useful answer to this similar question.
Downloading multiple files with wget and handling parameters
This code was provided to read urls from a text file filelist, then run a loop to download each.
#!/usr/bin/env bash
while read line
do
wget -c --load-cookies cookies.txt $line -O ${line##*/}
done < filelist
As I'm not familiar with shell scripts, I am wondering if you could download multiple xml files by:
- creating a simple comma seperated text file filelist
- read from:
filelist
renamedfile.xml, url-01.php
renamedFileDifferent.xml, url-02.php
specificFileRename.xml, "url-03"
newFilename.xml, "url-04"
- read through each line
- split the line into newfile, remoteFile
And run:
wget -O newfile remoteFile >/dev/null 2>&1
Is it possible to write this in a shell script? Can you provide an example?
filelistandtest.shin sub directory of your home, and then run it from there, that's where it will save the files. – Luke Sep 25 '12 at 01:03~\downloaddir\renamedfile.xml) and probably in the crontab as well (46 8 * * cd ~\downloaddir; test.shor maybe just46 8 * * ~\downloaddir\test.sh). Refer http://stackoverflow.com/questions/13204/why-doesnt-my-cron-job-work-properly and http://www.unix.com/shell-programming-scripting/129329-crontab-working-directory.html – Luke Sep 25 '12 at 11:09wget -O ~/downloaddir/${line/,*} ${line/*,} >/dev/null 2>&1and
– Luke Sep 25 '12 at 11:12done < ~/downloaddir/filelist