Script to provide content of latest file in the folder



  • Hello Experts,

    I have a directory where all the backup output file are stored with the timestamp. I want my script to provide me the output of that recently modified file.

    Is there any command from which I can view the recently modified file instead of specifying filename, because filename contains the timestamp.



  • This is a script problem for FreeBSD.

    For eg. from the pfSense Shell command line:

    ls -rt /cf/conf/backup/config-*.xml | tail -n 1
    

    Will give you the last backup config file saved.

    There's probably a few hundred ways to skin this cat,  just need to do a little research.

    Google is your friend  ;)



  • Thanks friend. It helped me..


Log in to reply