rejetto forum

set expiry to delete content

rleidt · 19 · 13420

0 Members and 1 Guest are viewing this topic.

Offline dj

  • Tireless poster
  • ****
    • Posts: 291
  • 👣 🐾
    • View Profile
    • PWAs
pseudocode:

if Sunday then 3
else if Saturday then 2
else 1

Code: [Select]
{. if |{.{.time|ddd.}=Sun.} | 3 | {:{.if|{.{.time|ddd.}=Sat.}|2|1.}:} .}
remind to replace Mon to Sun by their translations
« Last Edit: September 17, 2016, 05:16:56 AM by dj »


Offline rleidt

  • Occasional poster
  • *
    • Posts: 7
    • View Profile
So for 3 days from time of upload to delete but no deletion done Saturday, Sunday or Monday I would add into it like this (below) and set the #days to 3 as before ?

Or maybe DJ's post (just before this post) works too:

"if Sunday then 3
else if Saturday then 2
else 1

Code: [Select]
{. if |{.{.time|ddd.}=Sun.} | 3 | {:{.if|{.{.time|ddd.}=Sat.}|2|1.}:} .}

Can one of you piece this together so that I can copy and paste to test. In the end I'd just like to know where to set the # of days before deletion. I apologize again for not knowing this language but very happy you all jumped on the challenge.

********

[file=folder=link|private]

[at 0:00]
{.set|#actionday|0.}
{.for each|theday|,|tuesday,wednesday,thursday,friday|{:{if|{.=|{.lower|{.time|dddd.}.}|{.^theday.}/=.}|{:{.set|#actionday|1.}:}/if.}:}/switch.}

{.if|{.and|{.is file|%item-resource%.}|{.>|{.round|{.calc|%now%-%item-modified-dt%.}.}|3.}/and.}|
{:{.delete|%item-resource%|bin=0|forced=1.}:}|

[+file=+folder=+link|private]
   <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
        <input type='checkbox' class='selector' name='selection' value="%item-url%" {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
      {.if|{.is file protected|%item-name%.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
      {.if not|{.get|can access.}|<img src='/~img_lock'>.}
      <a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
      {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
      {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}

[+file]
<td>%item-size%B<td>%item-modified%<p>{.round|{.calc|%now%-%item-modified-dt%.}.}<td>%item-dl-count%

[+folder]
<td class='nosize'>folder<td>%item-modified%<p>{.round|{.calc|%now%-%item-modified-dt%.}.}<td>%item-dl-count%

[+link]
<td class='nosize'>link<td colspan='2'>

[+file=+folder=+link|private]
/if.}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13438
    • View Profile
nice project guys,
anyway since upload time translates to creation time of the file, you should consider and independent solution that's not really bound to HFS.

https://www.google.com/search?q=windows+delete+files+older+than

The perfect solution i'd look for is a software that monitors the file system, so to be efficient and not have to scan the file system periodically.

Otherwise you can accept simpler solutions requiring periodic execution, that you can accomplish thanks to HFS, like

[every 3h]
{.exec| your command .}


refer to the documentation for details about it


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2055
    • View Profile
@rleidt

I think you made a little mix

go to Menu -->Other Options -->Edit event scripts
or
in the hfs.exe  directory, create a text file called HFS.EVENTS and edit it

 add only the quoted following content in it

Quote
[at 0:00]
{.set|#actionday|0.}
{.switch|{.lower|{.time|dddd.}.}|,|tuesday,wednesday,thursday,friday|{:{.set|#actionday|1.}:}/switch.}

at 0:00 set the var #actionday to 1 when the current day is in the list, else 0


----------------------------------------------------------------------------
on VFS -> select the real folder -> go to his properties -->edit diff template

Quote
    [file=folder=link|private]
    {.if|{.and|{.^#actionday.}|{.is file|%item-resource%.}|{.>|{.round|{.calc|%now%-%item-modified-dt%.}.}|60.}/and.}|
    {:{.delete|%item-resource%|bin=0|forced=1.}:}|

    [+file=+folder=+link|private]
       <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
            <input type='checkbox' class='selector' name='selection' value="%item-url%" {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
          {.if|{.is file protected|%item-name%.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
          {.if not|{.get|can access.}|<img src='/~img_lock'>.}
          <a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
          {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
          {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}

    [+file]
    <td>%item-size%B<td>%item-modified%<p>{.round|{.calc|%now%-%item-modified-dt%.}.}<td>%item-dl-count%

    [+folder]
    <td class='nosize'>folder<td>%item-modified%<p>{.round|{.calc|%now%-%item-modified-dt%.}.}<td>%item-dl-count%

    [+link]
    <td class='nosize'>link<td colspan='2'>

    [+file=+folder=+link|private]
    /if.}

the action is running every day indicated, and only if a user display the directory on that day

otherwise you have to use an external program to perform the actions of delete, launched with the exec macro as told by rejetto
« Last Edit: September 18, 2016, 05:07:44 PM by Mars »