LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 06-21-2011, 11:00 AM   #16
liesandcake
LQ Newbie
 
Registered: Jun 2011
Posts: 6

Rep: Reputation: Disabled

Does it work with wget -i?
 
Old 06-21-2011, 12:52 PM   #17
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
you could try something like this

create a directory called 'process' or something like that, and within that a directory called 'files'
in the 'process' directory put
'filestodownload.txt'
Code:
#Format
#url|new_file_name
#one per line
#-----------------
http://img25.imageshack.us/img25/6350/saturn3.jpg|001.jpg
http://img98.imageshack.us/img98/8484/dsc01218ce.jpg|002.jpg
http://img19.imageshack.us/img19/3075/amazoness20quartet20mai.jpg|003.jpg
http://img153.imageshack.us/img153/1104/nanaelfenlied1246528400.jpg|004.jpg
and
'get.sh'
Code:
clear
for file in `cat filestodownload.txt | grep "#" -v` #search for all lines without a '#'
do
#split the line into 2 parts separated by the | (the url and the file name) and pass those parts to wget
wget `echo $file | cut -f 1 -d "|"` --output-document=files/`echo $file | cut -f 2 -d "|"`
done
edit filestodownload.txt accordingly, chmod +x get.sh and run away

Last edited by frieza; 06-21-2011 at 12:57 PM.
 
Old 06-21-2011, 01:53 PM   #18
liesandcake
LQ Newbie
 
Registered: Jun 2011
Posts: 6

Rep: Reputation: Disabled
That seems like an effective solution. I did a foreach loop, called curl each time, and used -o to rename each one with a temp variable which incremented upon each call of the loop.
 
Old 03-27-2013, 01:07 PM   #19
jgezau
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Rep: Reputation: Disabled
Quote:
Originally Posted by CodeLab View Post
Hi....

I Am wgetting List Of URLs From A Text File, Using

wget -i download.txt

I Want To Rename Each File As Its Downloaded..
Ordinarily,
wget --output-document=1.jpg http://images2.example.com/file1.jpg

Will Do The Job, It Will Rename file1.jpg to 1.jpg as its downloaded..


But How I Do It When List Of URLs Are Feed Via A File....

If I Construct My download.txt Like This

--output-document=1.jpg http://images2.example.com/file1.jpg
--output-document=2.jpg http://images2.example.com/file2.jpg
--output-document=3.jpg http://images2.example.com/file3.jpg

And I Run
wget -i download.txt

Then I Get This Error.
Unsupported scheme
No URLs found in download.txt


So, The Question Is How Should I Construct My download.txt File So That Each File Is Renamed As Its Downloaded,

Thanks
I have developed a script to do exactly this fairly easy. You just have to use "-rb" option on my script. Refer to link bulkGetter

Last edited by jgezau; 03-27-2013 at 06:01 PM.
 
  


Reply



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
rename errorsunknownp Linux - Newbie 2 12-28-2008 05:06 AM
wget not working! but "man wget is" ??? wrapster Solaris / OpenSolaris 5 07-30-2008 03:00 AM
how to rename user? mla Linux - General 2 07-03-2007 02:24 PM
where does konqueror and wget downloaded file go eatmars Linux - Software 2 08-28-2005 10:11 PM
Rename my pc ? Tanc Linux - Newbie 6 09-13-2003 08:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration