Home > English > How I saved my time with a simple script!

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.

while read line
    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!

Categories: English
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: