wget redirect file name


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers wget redirect file name
# 1  
Old 04-08-2011
wget redirect file name

I am downloading a file using wget and the following is embedded in a script:
Code:
wget http://www.example.com/ABCDfilename123.txt -O filename123.txt

Because the 123 is incremented with every day, I need to pass the file in a parametric manner, so the filename as given after capital D. How do I achieve this in the script?
# 2  
Old 04-09-2011
I first generate the string, and then use eval.

Code:
url_start="http://www.example.com/ABCD"
filename="filename123.txt"
wget_string=$(echo "wget "$url_start$filename" -O "$filename)
eval $wget_string

# 3  
Old 04-09-2011
Thank you for your response. The issue is however that I do not know beforehand that the file is called filename123.txt; it could be called filename138259.txt or any other non-guessable suffix. I use elinks -dump to retrieve the name of the files to be downloaded, so at least I know what comes after ABCD.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. https://www.sam.gov/SAMPortal/extractfiledownload?role=WW&version=SAM&filename=SAM_PUBLIC_MONTHLY_20160207.ZIP I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

2. Shell Programming and Scripting

Wget rename file

Is it possible to use a cookie transfer to a location and then rename the output? cd target_directory wget -x --load-cookies cookies.txt http://172.24.188.113/data/getCSV.csv | for file in * do mv $file $file.txt done For example, if I change the directory to C:\test and use the ... (2 Replies)
Discussion started by: cmccabe
2 Replies

3. Shell Programming and Scripting

Curl/wget shell script to follow redirect.

Hello eveyone. I would like to create a simple batch with curl (or wget) to download a URL but the URL I can only download from the browser and not from shell because curl and wget won't follow the 301 redirect which I get :confused: I tried with curl -L but no luck. I want to hear your opinion.... (5 Replies)
Discussion started by: accolito
5 Replies

4. Shell Programming and Scripting

Wget download file ( do not overwrite )

Hello all, I want to write auto update script for my embedded device, which can check and download newer version of my program and extract the files on the device. The download center is hosted on remote web server . Script checks the hosted file on web site and if the new version is there... (8 Replies)
Discussion started by: stefki
8 Replies

5. Shell Programming and Scripting

wget output file names

Hi, I have a list of urls in my input.txt file like this input.txt http://unix.com/index.html?acc=OSR765454&file=filename1.gz http://unix.com/index.html?acc=OBR765454&file=filename111.gz http://unix.com/index.html?acc=ORS765454&file=filename1111.gz... (12 Replies)
Discussion started by: jacobs.smith
12 Replies

6. Shell Programming and Scripting

How to download file without curl and wget

Hi I need a Shell script that will download a zip file every second from a http server but i can't use neither curl nor wget. Can anyone will help me go about this task ??? Thanks!! (1 Reply)
Discussion started by: rubber08
1 Replies

7. UNIX and Linux Applications

download file using wget

I need to download the following srs8.3.0.1.standard.linux26_32.tar.gz file from the following website: http://downloads.biowisdomsrs.com/srs83_dist There are many gzip files along with the above one in the above site but I want to download the srs8.3.0.1.standard.linux26_32.tar.gz only from... (1 Reply)
Discussion started by: alphasahoo
1 Replies

8. Shell Programming and Scripting

download a particular file using wget

Hi All I want to download srs8.3.0.1.standard.linux24_EM64T.tar.gz file from the following website : http://downloads.biowisdomsrs.com/srs83_dist/ But this website contains lots of zipped files I want to download the above file only discarding other zipped files. When I am trying the... (1 Reply)
Discussion started by: alphasahoo
1 Replies

9. UNIX for Dummies Questions & Answers

Using wget to download a file

Hello Everyone, I'm trying to use wget recursively to download a file. Only html files are being downloaded, instead of the target file. I'm trying this for the first time, here's what I've tried: wget -r -O jdk.bin... (4 Replies)
Discussion started by: thoughts
4 Replies

10. Shell Programming and Scripting

Script to download file using wget

Hi I need a Shell script that will download a text file every second from a http server using wget. Can anyone provide me any pointers or sample scripts that will help me go about this task ??? regards techie (1 Reply)
Discussion started by: techie82
1 Replies
Login or Register to Ask a Question