Monday, October 3, 2022

A Pretty Major Task Completed

Some time back, I created a subdirectory of My Pictures called astrophotos in which I placed hard links to some of my astrophotos.  As I mentioned a couple of days ago, going through 21 years of digital pictures, I found many about which I had forgotten.  (In case you are wondering: hardlinks take up almost no disk space, unlike a copy of the image.  They are only a pointer to the real picture.)  You can open them like a normal picture in your favorite image processing program, although save as goes to the folder with the hardlink, not the linked file.  This can be good or bad, depending on your goals.

But that is hundreds, perhaps thousands of pictures.  mklink /h linkname "actualfilename" is pretty quick but creating the list of mklink commands is slow.  So I figured out how to automate the process.  You do not want every photo, only the astro photos.

I could probably have done everything (except removing the non-astrophotos) with a rather elaborate ksh script of ls -l, awk, and mklink calls, but it was just a bit slower to use dir to produce lists of jpg files in each directory into a batch file, then use a keyboard macro in emacs to convert each filename into a mklink command, remove the non-astro pictures from the batch file, then run the batch file. 

No comments:

Post a Comment