mIRC Homepage

Is it possible for mirc to create folders?

Posted By: seanturner70

Is it possible for mirc to create folders? - 04/04/09 07:26 PM

Hi again,
I am trying to create a log system.

First, here is my script:
Code:
on *:TEXT:*:# {
  if ($me == no-nick) { write "C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy) $+ \ $+ index.htm" <br><font size="2" face="Verdana"> $asctime($calc($gmt - $duration(0hrs)),h:nntt) GMT - $asctime($calc($gmt - $duration(5hrs)),h.nntt) PST --<b> $nick $+ : </b> $1- }
}

However...
This doesn't seam to work...
Instead I get:
Quote:
-
* /write: unable to open file 'C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\Ustream\#iwearyourshirt-daily-shirt-s\04.04.09\index.htm' (line 2, onlinelogsTBINT)
-


When I create all the folders needed, it writes correctly, but, the objective of the script is to separate all the logs out into days, so they are more easily readable, and can be uploaded to the internet, to be read if people want it to be. It would be very difficult to have all the folders created, and so I need a way I can automate it.

Thank you very much for any help smile
Posted By: genius_at_work

Re: Is it possible for mirc to create folders? - 04/04/09 07:48 PM

$isdir

$exists

/mkdir

-genius_at_work
Posted By: seanturner70

Re: Is it possible for mirc to create folders? - 04/04/09 11:02 PM

Thank you.

I have tried using this, but I am obviously not using it correctly. I have tried many different variations of it, and the closest I have got is:
Quote:
-
* /mkdir: invalid parameters (line 3, script56)
-


The code I have just now is:
Code:
on *:TEXT:*:# {
  if ($me == no-nick) {
    if !$exists("C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy)") { /mkdir "C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy)" }
    if ($chan != #no-nick) { write "C:\Documents and Settings\Sean's\My Documents\Web\Logs\networks\ $+ $network $+ \ $+ $chan $+ \ $+ $asctime($calc($gmt - $duration(0hrs)),dd.mm.yy) $+ \ $+ index.htm" <br> $1- }
  }
}


Thanks, and sorry for the bother.
Posted By: RusselB

Re: Is it possible for mirc to create folders? - 04/04/09 11:23 PM

Since you have multiple directory levels that you are using, you have to check that each level exists, and if that level doesn't exist, then you have to use /mkdir for each level

eg:
"C:\Documents and Settings\Sean's\My Documents" probably exists due to the method that Windows uses to create the My Documents folder.
However, the sub-directory Web might not exist, so you need to check if it does exist or not, and if it doesn't, then create that directory.
Then you have to do the same thing for:
Logs
networks
$network
$chan
and whatever the date response that you get for the calculation you have at the end.

P.S.: You can shorten your calculation for the date response by using $gmt(dd.mm.yy) as the calculation of $gmt - $duration(0 hrs) is going to return $gmt
Posted By: seanturner70

Re: Is it possible for mirc to create folders? - 04/04/09 11:39 PM

Ok, thank you very much Russel smile
© 2022 mIRC Discussion Forums