Tag Archives: download

How to Set Wget Target Directory Tips, Tricks and Tutorials 12 JUN 2014

If I ever need to pull something down from a website while working on an Ubuntu Server instance, then without a doubt, wget is my go to guy. From the man pages:

GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Wget is non-interactive, meaning that it can work in the background, while the user is not logged on. This allows you to start a retrieval and disconnect from the system, letting Wget finish the work. By contrast, most of the Web browsers require constant user’s presence, which can be a great hindrance when transferring a lot of data.

Wget can follow links in HTML, XHTML, and CSS pages, to create local versions of remote web sites, fully recreating the directory structure of the original site (recursive downloading). Wget can be instructed to convert the links in downloaded files to point at the local files, for offline viewing.

Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved. If the server supports regetting, it will instruct the server to continue the download from where it left off.

So all in all, a VERY useful tool. The question being solved today is how to go about setting or specifying the target directory wget should be saving the downloaded files to. The short answer is that in the strictest sense you can’t – but you can specify a string prefix to add to all downloaded files, thereby allowing you to essentially set the wget target directory!

Again from the man pages:

-P prefix
--directory-prefix=prefix
Set directory prefix to prefix.  The directory prefix is the directory where all other files and sub-directories will be saved to, i.e. the top of the retrieval tree.  The default is . (the current directory).

In practice, if we want to download a file to /home/craiglotter then we would add -P /home/craiglotter/ to our command. In practice:

wget -P /home/craiglotter/ http://www.craiglotter.co.za/wp-uploads/image.jpg

The above would download the image.jpg file to /home/craiglotter/image.jpg.

Useful to know.

ubuntu black and orange logo

Related Link: http://manpages.ubuntu.com/manpages/trusty/man1/wget.1.html

WordPress: Force Contact E-mail before Allowing a File Download CodeUnit 25 SEP 2012

The other day one of the WordPress sites I was asked to help out on (http://www.portsevolution.com) needed a solution whereby they first needed to receive some contact details before allowing a reader to download an associated PDF file.

Digging around the WordPress plugin repository I came across a great solution in the form of a plugin by M&S Consulting, entitled “Email Before Download”, which basically combines the functionality of the excellent WordPress plugin “Contact Form 7” with that of “WordPress Download Monitor” to achieve the required functionality.

Taken from their official description: Email Before Download presents your users with a form where they submit information, like their name and email address, prior to receiving a download. This plugin integrates with the popular Contact Form 7 and WordPress Download Monitor plugins, allowing you to create any form you like and manage/monitor your file downloads. You can also export a list of users that have downloaded files from the plugin’s settings page.

As an option, you can configure Email Before Download to:

...

How to Install NetBeans 7.0.1 in Ubuntu 11.10 CodeUnit 23 NOV 2011

I quite enjoy using the free to use NetBeans as my PHP editor/IDE of choice, more info on which can be found at the offical website: http://netbeans.org/. This is a quick step through of how to install the latest stable version of NetBeans, i.e. 7.0.1, into your Ubuntu desktop.

Disappointingly, NetBeans isn’t included in the new fancy Ubuntu Software Center, so let’s just grab it as if we were using any old Linux installation. First, browse to the official NetBeans download page at http://netbeans.org/downloads/index.html

Select the IDE language and Platform you need NetBeans for (in this case obviously we need the Linux (x86/x64) version), and then select the initial supported technologies version you require from the download table. In my case I only need the PHP version, so I click on the 41 MB download under the PHP column.

Once the download of the .sh file is complete, open up a terminal and browse to your Downloads folder (In my case, the download was saved as netbeans-7.0.1-ml-php-linux.sh). Now to launch the install process:

sudo bash netbeans-7.0.1-ml-php-linux.sh

After entering in your administrative password, the NetBeans installer dialog will launch. Follow the prompts as you normally would for any other installer, and voilà, you’ll now find the NetBeans 7.0.1 launcher sitting under the Programming menu in the main Applications menu – if you aren’t using the new Unity menu system of course. If you are, then simply search for NetBeans and you’ll be good to go! ;)

How to Download Facebook Photo Albums CodeUnit 26 SEP 2011

It is all very well to upload and share your photos with the world on Facebook, but sometimes it is also pretty handy to be able to pull them down again for backup purposes. Enter a brilliant little application that makes it a breeze to download full photo albums from either your own profile, associated groups or liked pages.

Pick&Zip is the fantastically clean and well presented online tool which through it’s flash driven interface allows you to select your own albums or photos where you have been tagged and then download the selected set either as a zip file or as a pdf – directly from your browser! No messy installs to work with whatsoever! :)

To work, it requires that you allow the app to link with your profile, and if you are okay with that, go ahead and log in using the Facebook oauth login system. From there it is a matter of browsing the albums you want to view using the tree on the left, selecting the photos to download and then confirming the download format – as simple as that!

One thing to note though is that thanks to Facebook’s new privacy controls, the application only allows you to download files uploaded by your friends, which makes sense but is a little frustrating if you wanted to say download other people’s albums for more devious purposes (not that you ever would of course!) :P

It is well written, features a great interface and is packaged in a very clean and colourful website, making this definitely one of the premier ways of taking back control of your Facebook photo albums!

Related Link: http://www.picknzip.com

PHP: How to Force a CSV File Download CodeUnit 14 SEP 2011

CSV files are handy ways of handing over long lists of data like transactions, audits, surveys or logs over to a user, particularly because they are so universally supported by just about all spreadsheet applications.

Normally when you want a user to download a file you simply force the browser to point to the location of the file you want them to download, however as we all know, this doesn’t always work as often the browser will decide what to do with the file – be it to display the file contents, redirect you to a particular browser plugin, or give you the choice as to whether you want to download the file or perhaps do something else with it.

Because CSV files are nothing more than plain text files, browsers often choose simply to open them up as text, pretty useless in that if forces the user to now look for the “save as” option in the browser’s menu system.

Luckily, the way to get around this and force a download is pretty common to most file types – all you do is set the necessary header information and then read the target file’s contents and push it straight to the browser via the output buffer.

So let us see this in action for a CSV file then:

ob_start();
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=downloadrecords.csv");
readfile($_SERVER['DOCUMENT_ROOT'] . '/downloadrecords.csv');
ob_end_flush();

In the above example we want the user to download /downloadrecords.csv. Now instead of directing a user directly to that path, we instead send them to a force download script, with sets the necessary headers like the all important content-disposition header, and then simply read the existing CSV file contents straight into the output buffer using the handy readfile function.

Flush the buffer and the browser will now do the rest.

Nifty.

Download SQLyog Community Edition CodeUnit 11 MAY 2011

SQLyog is an exceptionally good GUI Management Tool for MySQL databases and is well worth the purchase price if you develop and maintain a large number of MySQL databases. It is developed by Webyog and comes in three main flavours, namely Professional, Enterprise and Ultimate. However, if you are a single developer working on your own and pretty much a shoestring budget, then you’ll be happy to know about the existence of the fourth, most importantly FREE flavour of the excellent SQLyog, the Community Edition.

Now no longer available (or even mentioned) on the main Webyog website any more, locating the free Community Edition download can be a little tough if you don’t know where to look, hence this blog post. A little while ago it was decided by Webyog to spin off the Community Edition as an open source Goo06gle Code project, located at http://code.google.com/p/sqlyog/.

This means that the installer download for SQLyog Community Edition is now located at http://code.google.com/p/sqlyog/downloads/list.

Grab it, take it for a test drive and you definitely won’t look back. Seriously, if you work on a Windows box, then kiss phpMyAdmin goodbye! :)

Related Link: http://code.google.com/p/sqlyog/downloads/list

Highschool of the Dead: Episode 12 Anime 18 OCT 2010

All Dead’s Attack

It is the start of Armageddon as China and the United States start tossing nuclear ballistic missiles at one another. Despite the joint US-Japanese air defences, one of China’s retaliatory missiles break through, resulting in a massive EMP burst that instantly fries all electronics and brings virtually all machinery in Japan to a standstill. Of course, this means the defences of the estate stronghold is now basically down, inviting a full scale invasion  by the zombies! (or “them” if you still want to be a purist)

So apart from the big decision the group still needs to make on whether or not to stay with Saya’s parent’s group, they now have to contend with a full frontal zombie attack – with no viable escape route in sight!

So the first anime season of the frustrating in terms of potential zombie horror survival Highschool of the Dead comes to an end, obviously leaving a huge opportunity for sequels thanks to the series’ short 12 episode length, but ending off with a satisfying enough mini conclusion in terms of the kids’ making some necessary big decisions and of course simply continuing with the fight just to stay alive.

It’s nice to see director Tetsuro Araki tear himself away from the mindless and pointless fan service he so mercilessly drenched what otherwise could have been a pretty awesome series with, and instead stick to what made the show so exciting in the first place – zombies, zombies, zombies and some exceedingly cool, over the top, mind blowing action!

True, there are all the usual and expected sentimental little bits to get through, but with those all out of the way, the series ends off with a proper and exciting bang, making for a worthwhile episode to watch.

As per usual, the animation is slick, full of the necessary detail and beautifully colored. In addition to the visuals, Kishida Kyodan and The Akeboshi Rockets’ opening track continues to be pretty damn brilliant while the tail gets wrapped up in the usual pleasing fashion by yet another random Maon Kurosaki song, a gimmick that has worked well for this particular series.

In conclusion, the conclusion for Highschool of the Dead delivered exactly what you would expect from a 12 episode long series (in other words not a real ending so to speak), does it in style, steps back ever so slightly from the unnecessary fan service that was dragging down the credibility of the show and leaves you wanting some more.

In other words, no real reason not to catch it if you haven’t yet! :)

Download Highschool of the Dead 12: Removed

Related Link: http://en.wikipedia.org/wiki/Highschool_of_the_Dead

FileCrop: RapidShare and MegaUpload Search Engine CodeUnit 17 MAY 2010

I’ve mentioned the great MegaDownload.net RapidShare and MegaUpload search engine on this site before, but now a new site has caught my fancy, namely FileCrop.

Like I mention above, at the heart of it all, FileCrop is simply a search engine in the sense that it collects links to uploaded files hosted on RapidShare and MegaUpload, two of the Internet’s biggest providers of public accessible file drop sites. This of course opens up a wealth of download possibilities, be it downloads for those hard to find anime episodes you are looking for, or perhaps an desktop application you no longer can locate an official download point for.

FileCrop is quick, features a growing database of about 22 million links, is simple to use and doesn’t seem to feature any adverts or spam content. It gives a good amount of detail about the files retrieved based on your search criteria, and goes that extra step in allowing you to dictate in part where it searches and in what size range the results should be.

Slick, works well and a great little tool to find those gems you like holding on to as entertainment on those frequent little tea breaks of yours.

Related Link: Removed

How to Download to a Specific Directory using Wget for Windows Tips, Tricks and Tutorials 26 APR 2010

The Wget for Windows application is of course exactly that: the classic GNU/Linux wget application built for Windows command line usage.

Of course, this means that most if not all command line switches are still available to you, just as what they would be had you been running the latest wget from your Linux distro of choice.

The question I’m answering today is how to specify which directory wget is to save what it is downloading to.

Normal usage sees wget placing whatever it grabs in the directory from which it is called.

You can of course specify a specific file to which to save your downloaded web page when downloading a single page by making use of the -O switch, resulting in something that looks like this:

"C:\\wget.exe" -O "C:\\downloadpage.txt" "http://www.download.co.za/index.html"

If however we want to specify the directory to which wget must save its downloaded content to, we need to make use of the -P switch, which the results in a call looking like:

"C:\\wget.exe" -P "C:\\download" "http://www.download.co.za/index.html"

So at the end of the operation specified above, we would be sitting with a file named index.html in the directory C:\\download.

And that’s how you specify to which directory wget must drag its captures down to!

Related Link: http://gnuwin32.sourceforge.net/packages/wget.htm