Results 1 to 10 of 10

Thread: Cron job to replace file according to system date

Threaded View

  1. #1
    Join Date
    Aug 2008
    Location
    127.0.0.1
    Beans
    80
    Distro
    Xubuntu

    Lightbulb Cron job to replace file according to system date

    Hello all,

    I am totally new to bash scripting and cron, so please forgive my lack of knowledge.

    I am trying to create a cron job that will (most likely via a bash script) compare file names to the system date and replace a file with one that has today's date in the name. This needs to be a job that would run once daily indefinitely.

    For instance, I have the following files:

    1217.html
    1218.html
    1219.html
    today.html

    The system date today is 12/18, so the idea would be to overwrite today.html with 1218.html.

    I need to not have the year in the file name, so I would not be able to name the files 12182019.html or 121819.html.

    I am sure that this has been addressed in other threads, but I don't know how to word a search to get the results needed. Pointing me in the right direction as far as where to look for ideas on how to do this would be greatly appreciated.
    Last edited by erictherev; December 18th, 2019 at 07:04 PM. Reason: clarification (intended use)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •