imgfs. Dealing with those annoying image file names on Google+

Had you ever got feed up with all those images on Google+ with the same file name?. Maybe this is not an issue for you or maybe there are simpler solutions, but for me it had become pretty annoying the fact that most of the pictures in the Google+ post have the same name so I have always to rename the file before saving it.

I had noticed that Chrome, renames the files automatically for you. That might be a solution. However I've been developing some animadversion to those tools that do things "for you" without letting you know... so I do not use Chrome in general. Firefox, my standard browser does not rename files automatically so I worked out my own solution.


I know this project from long ago and I find it awesome. I always wanted to try it and know a bit more on how it works so this was an excellent excuse to try it. I would build a simple filesystem which will automatically rename files if somebody try to re-write them.

Actually the idea is to make this evolve in something more sophisticated and also use it as a test bench for image classification ideas... let's see if I finally do something like that. Right now, I can now safely save the images from Google+ using firefox without caring about giving them a proper name.

BBFS and imgfs

So, I searched Internet for some good tutorial and I found an excellent one here:

The best thing about this tutorial is that a fully functional filesystem (Big Brother File System BBFS) is included. Something you can quickly start modifying to get results. And so I did.

imgfs, is currently just the BBFS without logging and with a minimal modification on the truncate system call implementation.

Initially I was thinking on modifying the open or the access system call but, actually using the BBFS I could monitor which calls Firefox performed on the disk and found out that once you tell Firefox to overwrite your image, the first thing it does is to truncate the file.

So, that is it. Whenever a tool tries to truncate an existing file, that file is copied into a new one tagged with the current time stamp in unix time. Not the most efficient or elegant solution but it works pretty well and looks like a good starting point.

I had uploaded the modified code to github in case any of you may find it also useful. Here is the repository:


As I said this is basically BBFS so the usage is actually the same. Just pass to the imgfs executable two parameters, the original directory where you usually save your pictures and an empty directory that will be used as mounting point. Something like this:

$ imgfs ./my_pictures ./autorenamed_pictures

The on firefox you will still get the dialog asking you if you want to overwrite the file or cancel and try a different name. Now you can just press Overwrite an the old file will be automatically renamed.

I'm currently testing it and it is working OK for now...