LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Download files from a list while (re)naming them at the same time

Posted 11-27-2015 at 12:27 PM by the dsc
Updated 11-27-2015 at 12:33 PM by the dsc

"wget -i" is perhaps the tool of choice to download files from a list, but it doesn't allow you to set custom file names for the individual files on the list file. So, if you want to download a bunch of podcast episodes, but would want each file to have a descriptive file name rather than "12345.mp3", it won't help you.

A simple alternative is to have a download list with the file URLS followed by the "-O" flag and desired file name, and read this file in a loop as arguments for an wget command:

Code:
http://www.someurl.com/podcast/432432.mp3 -O 34-that-very-interesting-thing.mp3
http://www.someurl.com/podcast/565767665.mp3 -O 102-cool-podcast-episode.mp3
http://www.someurl.com/podcast/3323.mp3 -O 12-thats-the-twelvth-episode.mp3
Then:

while read url ; do wget -c $url ; done < url-list.txt

One could make a script that would take a file list without the "-O" flag and try to parse it correctly, but why bother, that's so much simpler.
Posted in Uncategorized
Views 2484 Comments 3
« Prev     Main     Next »
Total Comments 3

Comments

  1. Old Comment
    why don't you use youtube-dlyoutube-dl, you can even program it to perform renaming according to its meta-data.
    Posted 12-01-2015 at 05:23 AM by jheengut jheengut is offline
  2. Old Comment
    Quote:
    Originally Posted by jheengut View Comment
    why don't you use youtube-dlyoutube-dl, you can even program it to perform renaming according to its meta-data.
    though it is still limited to multimedia files only
    Posted 12-01-2015 at 05:24 AM by jheengut jheengut is offline
  3. Old Comment
    Youtube-dl is specialized in certain "big" sites, and tries to guess some others as "generic". I think there's the risk that it won't always know how to give a meaningful file name, using something akin to a file "ID" or the actual remote file name, whatever it may be. Maybe the meta-data would be just "podcast 23123132" or whatever.

    But it never occurred to me to try to use it for non-video multimedia sites, even though often I use it to download just the audio from youtube itself. Got to try it sometime. But I bet it would be more likely to work on sites such as soundcloud.com than something like im-this-random-guy-who-has-this-podcast.com.
    Posted 12-04-2015 at 12:40 AM by the dsc the dsc is offline
 

  



All times are GMT -5. The time now is 11:14 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration