Give me the most current file

I needed a quick way to maintain a current symlink to the most recent file by time stamp. Here’s one way to do it:

ls -t1 *.jpg | head -1 | xargs -i ln -sf {} current.jpg

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.