enhancement: hard links with exiftool

Started by RobK, March 12, 2014, 05:59:24 PM

Previous topic - Next topic

RobK

Hi all!

Wouldn't it be nice if exiftool would not only be able to copy and move/rename files, but could create hard links, too?

That way, one would be able to organize the files using hard links, and when content, delete the source files to only retain the new files without wasting disk space too excessively.

This could be quite useful on a library containing GBs of thousands of pictures that need to be reorganized by date/time information. Or to organize things based on the comments while not losing the original structure, or to simply provide another view on the data based on xyz criteria.

Another use case would be to create an in-place backup of a pile of files, browsing through it, deleting some, then deciding to not having deleted the last four ones. No problems with hardlinks in another corner of your hard disk or RAID, ie. file system (ymmv) - just create a hard link from the backup and things are there again. If all went well, you may safely delete all hardlinks initially created.

Hard links don't use much disk space and are easy to maintain. You don't need them - just delete them, as long as you keep the last one - after its deletion, the file will be more or less history.

Seeing exiftool being able to create hard links instead of moving/renaming pictures would be great!

Cheers,

RobK

Phil Harvey

Hi Rob,

Interesting idea.  I'm not even sure if there is a platform-independent way to do this in Perl (likely not though, because Windows is funny that way).  But I'll think about this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

RobK

link() should do the job on NTFS, at least with ActiveState's Perl implementation, see [1] and [2]. As I don't own a Windows installation anymore, I can't say much more about it.

Looking forward for a future version of this great piece of software supporting hard links!

Cheers,

Rob

[1] http://code.activestate.com/lists/perl-win32-users/32944/
[2] http://perl5.git.perl.org/perl.git/commitdiff/6b980173

Phil Harvey

I have added a new write-only HardLink tag, and this feature is currently being tested.  It behaves just like writing the FileName tag, but a hard link is created instead of renaming the file.  If all goes well it should appear in version 9.55 (release planned for Saturday).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

RobK

Wow, that's stunning, thank you, Phil!

Looking forward to the new release, which I will encounter a bit later when it receives in my systems repositories.

Cheers,

Rob

RobK

Dear Phil,

I forgot to give a huge "Thank you" after trying out the new feature essentially a long time ago - it's exactly what I missed in exiftool and how I expected it to appear.

Though I must admit, that the usage could be a bit more verbose on the website and especially in the man page (where it is not noted at all), I find the feature very useful! Well, might not be too surprising, coming from the person wh asked for it :-)

Continue your very good work on exiftool. You have me as a fan. (To be honest, you already had me as a fan even before implementing this feature...)

Have a nice holidays and a brilliant 2015!

Cheers,

Rob

Phil Harvey

Hi Rob,

Thanks for the note.

You're right, it is missing from the documentation.  There are a number of cool little features implemented via the Extra tags that are not documented elsewhere because they are not in popular demand and the documentation is already too long for any reasonable person to read. ;)

But it is always rewarding when I can implement a cool fringe feature like the HardLink when I know it is at least useful to one person. :)

- Phil

P.S.  Merry Christmas!
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).