mIRC Home    About    Download    Register    News    Help

Print Thread
#109713 31/01/05 10:53 PM
Joined: Jul 2004
Posts: 21
X
xhine Offline OP
Ameglian cow
OP Offline
Ameglian cow
X
Joined: Jul 2004
Posts: 21
is there anyway, with mirc, to get the date of when a specific file or folder was created?

#109714 31/01/05 11:38 PM
Joined: Mar 2004
Posts: 175
Vogon poet
Offline
Vogon poet
Joined: Mar 2004
Posts: 175
Code:
$file(file).ctime


- Relinsquish
#109715 01/02/05 01:11 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
As far as the folder date is concerned, there is no built-in function, though you can let COM do most of the work.

Usage: $folderdate(folder path)

returns the $ctime value for the creationdate. I left it raw like that so that you can do your own formatting using $asctime

Example: $asctime($folderdate($mircdir),dd/mm/yy HH:nn:ss)

Code:
alias folderdate {
  if !$exists($$1\) { echo -ac info $!folderdate - no such folder $1 | return }
  var %a = a $+ $ticks, %b = b $+ %a
  .comopen %a Scripting.FileSystemObject
  if !$comerr {
    .comclose %a $com(%a,GetFolder,1,bstr,$1\,dispatch* %b)
    if $com(%b,DateCreated,3) {
      %a = $com(%b).result
      .comclose %b
      return $int($calc(((%a -25569)*86400)+$timezone))
    }
  }
}


Gone.
#109716 04/02/05 08:45 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Or you can stick to the $file(foldername).ctime method if you remove the trailing "\" (or "/") laugh
  • //echo -a $asctime($file($left($mircdir,-1)).ctime)

#109717 09/02/05 09:21 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Oo interesting! Wish the help file would have stated that it works on folders too lol, woulda saved me 15 mins of useless work.


Gone.
#109718 02/03/05 09:53 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
It turns out this doesn't work on all systems, so the COM snippet might be preferred actually.

2 people in helpdesk got 315554400 as returned value which translates to Tue Jan 01 00:00:00 1980

on both:

$asctime($file(c:\windows).ctime)
$asctime($file(c:\program files).ctime)

Oh well...


Gone.

Link Copied to Clipboard