I have some directories:
drwxr-xr-x 10 shamoon staff 320B Mar 20 10:05 dryrun-20200320_140542-1vbczul4
drwxr-xr-x 10 shamoon staff 320B Mar 20 10:06 dryrun-20200320_140605-uze15jta
drwxr-xr-x 10 shamoon staff 320B Mar 20 10:06 dryrun-20200320_140644-193bynci
drwxr-xr-x 13 shamoon staff 416B Mar 20 10:07 dryrun-20200320_140721-fuv399ji
drwxr-xr-x 13 shamoon staff 416B Mar 20 10:08 dryrun-20200320_140810-34dim70r
drwxr-xr-x 14 shamoon staff 448B Mar 20 10:10 dryrun-20200320_140935-138yuidx
drwxr-xr-x 14 shamoon staff 448B Mar 20 10:23 dryrun-20200320_141044-35pfvec6
drwxr-xr-x 14 shamoon staff 448B Mar 20 11:14 dryrun-20200320_151418-14g88zfr
drwxr-xr-x 14 shamoon staff 448B Mar 20 12:11 dryrun-20200320_151800-gf551inz
drwxr-xr-x 14 shamoon staff 448B Mar 20 12:21 dryrun-20200320_161134-wyu9kaxu
I want to set up a symlink to the most recent. Now, there may be more recent directories created, so ideally, the symlink should also automatically update. Is this possible?
Best Answer
This isn't possible to do automatically -- Unix provides no facility for symlinks to dynamically change. However, you can have a program in the background that updates the symlink using
inotify
and the fact that later files sort as being later withLC_COLLATE=C
:And here is the result of it running: