A one-line which creates a file your browser will probably be unable to deal with.

Introduction

I do have a harddisk filled with files. And those files do not always have names which are really helpful, i.e., they do not always provide a 100 percent accurate description of what's in that file. The problem ocurrs esepcially with pictures: There are so many pictures which contain things you obviously do not encode in a filename. You name a file "sunset.jpg", maybe "sunset-2016-10-04-frankfurt-westend.jpg", perhaps even "sunset-2016-10-04-frankfurt-westend-with-the-guys.jpg" but your memory always knows more than you will encode in a filename. Some months or years later, you need that picture because on the table there have been exactly those pepper shakers you want to reference in a conversation. But unfortunately you have no idea where you've put that picture. Or what its name was. Or the occasion. All you remember is that you took a picture which included that pepper shaker you desperately want to reference now.
And then you start browsing your file system -- always looking for that maybe-this-file picture. That sucks? Oh yeah.

The idea

This was when I started to thing of an easier way to do this. And in the end, the idea is simple -- I sure will recognize the picture way faster than anything else, and to do so, I don't need to see it at full resolution. Plus I do have a program installed which -- according to it's self-description seems to be outstandingly appropriate to present me such sheer mass amounts of data. My browser.
That was when the idea was born: Scratch over the harddrive with find, grep for all the pictures available, then paste the filenames into one big html-file and scroll them with a browser.

Implementation

The idea is quite straight forward: We search for all files within subsequent directories and if they do have the typical extension of an image file, we add them to our list of files to display which we write to imgs.html. We further let the browser shrink them to maximal dimensions of 400px height or 640px width and make them a link to the actual file (which is also very handy).

shell# echo "<html><body><center>" > imgs.html ; find . | egrep '.*(jpe?g|gif|png)$' | awk '{ print "<a href=\"" $0 "\"><img style=\"max-width:640px; max-height:400px\" src=\"" $0 "\" /></a>"} '>> imgs.html ; echo "</center></body></html>" >> imgs.html

And then have fun

Performing above command results in a file covering more than 3500 images to display on a some-years-used general purpose system. Grab a popcorn bucket and feed your browser with that file -- and then see it struggle. Firefox 47.0.1 on Windows rendered frozen w/o any response as soon as the file was issued to be put on display; IE 11 at least tried and displayed some files (I even could scroll a bit!) before the tab process got unresponsive and had to be killed.

Warning

You may want to try this script when you're alone. You may find pictures not to be proud of.

Stichworte:


Impressum