mIRC Homepage

file last edited

Posted By: spermis

file last edited - 26/04/11 03:11 PM

Hello. Could you give me an example, how could i get to echo those filenames from a directory, which where last edited before april 1st? For example, i have a lot of text files in directory mirc/txts . and if there are files text1.txt text2.txt text3.txt , and text2.txt and text3.txt have been last edited on february 29th, it would show - text2.txt and text3.txt were last edited before april 1st.
Thanks wink
Posted By: Brax

Re: file last edited - 26/04/11 03:45 PM

Help > File and Directory Identifiers.

$file(filename).mtime "returns last modification time"

This in hand its a matter of looping through your directory and outputting the filenames that you want.

Code:
alias beforeapril {
  var %i = 1
  while ($findfile($mircdirtxts, *.txt,%i,var %file = $1-)) {
    if ($file(%file).mtime > 1301605200) {
      echo $nopath(%file) (Last modified $asctime($file(%file).mtime,dd/mm/yy) $+ )
    }
    inc %i
  }
}
Posted By: Riamus2

Re: file last edited - 26/04/11 04:52 PM

You can use $findfile()'s built-in looping:

Code:
alias beforeapril {
  noop $findfile($mircdirtxts,*.txt,0,0,if ($file($1-).mtime > 1301605200) echo -a $nopath($1-) (Last modified $asctime($v1,dd/mm/yy) $+ )))
}
© 2021 mIRC Discussion Forums