Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Script to provide content of latest file in the folder

    General pfSense Questions
    2
    3
    638
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yunushaikh
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • D
        divsys
        last edited by

        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  ;)

        -jfp

        1 Reply Last reply Reply Quote 0
        • Y
          yunushaikh
          last edited by

          Thanks friend. It helped me..

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.