Is there a way in Linux to automatically maintain a symlink to the latest version of a file/folder in a certain location?

My use case:

  • I generate datasets with unique job names, then write them to a 'results' folder
  • I manually recreate a symlink to the latest version, naming it 'current'
  • I can then always know 'current' refers to the most recent dataset
  • This doesn't need to be perfectly instantaneous - accuracy on the order of seconds is acceptible.

I realise this can be achieved with a bash script and cron, but am wondering if there's a filesystem/OS feature that's more elegant.

  • 4
    use inotifywait -m or alike to trigger the script on event. – A.B May 17 '19 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.