Ad Widget

Collapse

Use item in item key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Glide
    Junior Member
    • Jan 2021
    • 10

    #1

    Use item in item key

    I have an item containing a file path, Key: some.log.file
    I need to get the modification time of this file in an item.

    So I naïvely tried to create an item with the Key: vfs.file.time[//some.log.file]
    Of course it's complaining about the file not existing.

    I tried enclosing //some.log.file between ``, "", {}, it doesn't seem to help.
    How can this new item evaluate //some.log.file before executing the vfs.file.time function on it ?
    Should I use a calculated or dependent item ? If yes, how ?
    Last edited by Glide; 22-12-2021, 11:33.
  • Glide
    Junior Member
    • Jan 2021
    • 10

    #2
    I finally used a single system.run item instead of 2 items, as it seems complicated to base one onto another.
    Code:
    system.run[echo $(($(date +%s) - $(date +%s -r `ls -td my-directory/* | head -n1`)))]
    This gives me the age of the latest file on a directory

    Comment

    Working...