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

Script to provide content of latest file in the folder

Scheduled Pinned Locked Moved General pfSense Questions
3 Posts 2 Posters 656 Views
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 Nov 23, 2015, 3:24 PM

    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 Nov 23, 2015, 6:02 PM

      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 Nov 23, 2015, 6:29 PM

        Thanks friend. It helped me..

        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
          This community forum collects and processes your personal information.
          consent.not_received