How I saved my time with a simple script!
I am currently doing some stuff which is related to a set of test MP3 files which are stored in a webserver. These files are more than 200 and I had to retrieve all of them from the server and save them in a directory on my laptop. As a bonus, I had also a txt files which contained a list of all the MP3 files to be dowloaded, every MP3 file name was a line of this txt file. I started dowloading them by using the good old “right-click and save file” but after the first two files I felt I was doing my job like a monkey!
After 2 minutes I had the following script ready. This script reads all the file (line by line) and retrieve the MP3 file from the webserver.
#!/bin/bash while read line do wget "http://myhost.com/"$line -o log_file.txt done < mylist.txt
Job done! Mission accomplished! Time for a beer with friends!
Now, this script is very easy and can be adapted to perform several common tasks: it is not here to show you how to do stuff, it’s just here to show how you can save your time with a little of effort!