mIRC Home    About    Download    Register    News    Help

Print Thread
file last edited #231640 26/04/11 03:11 PM
Joined: Feb 2007
Posts: 91
S
spermis Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Feb 2007
Posts: 91
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

Re: file last edited [Re: spermis] #231641 26/04/11 03:45 PM
Joined: Jan 2005
Posts: 192
Brax Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2005
Posts: 192
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
  }
}


echo -a $signature
Re: file last edited [Re: Brax] #231644 26/04/11 04:52 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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) $+ )))
}


Invision Support
#Invision on irc.irchighway.net