removing files script problem.

Posted by: Navid

removing files script problem. - 04/07/05 03:53 AM

Hello.
I already posted an topic about this but I dont know where did it go.
Anyways here is the problem. I cant remove some files from my mirc folder with this script:
Code:
 
on 4:TEXT:!delete *:#: {
  /delete $2
  msg $chan 12Deleted $upper($2) $+ 's stats!
}

and here is the alias for $delete
Code:
delete {
  /remini Members\ $+ $1 $+ .dgt
  /remini Moves\ $+ $1 $+ .moves
}
Posted by: Collective

Re: removing files script problem. - 04/07/05 04:02 AM

/remini is for removing sections/items from an ini file.

To remove a file from your computer use /remove [color:green]filename[/color].
Posted by: SladeKraven

Re: removing files script problem. - 04/07/05 04:17 AM

If each user has their own file, then /remini isn't the command to use. You'd need /remove.

If you had all your users in one file like:
Members.ini contains..

[Members]
Andy=$true
Navid=$true

etc

You'd use:
/remini Members.ini Members Andy

So with the files as it is now use something like..

Code:
on 1:TEXT:!delete *:#: { 
  if ($isfile($+(Members\,$2,.dgt))) && ($isfile($+(Moves\,$2,.moves))) { 
    .remove $+(Members\,$2,.dgt) 
    .remove $+(Moves\,$2,.moves) 
    msg $chan 12Deleted $+($upper($2),'s) stats!
  }
  else { msg $chan $+($chr(3),12,$upper($2) does not have any stats!,$chr(3)) }
}


-Andy
Posted by: Navid

Re: removing files script problem. - 04/07/05 05:13 AM

I tried remove before. for some reason it didnt work.
I'm gonna give it a try with the code you gave me smile

EDIT: Andy I tried yours and it didnt work.
Quote:
<@[D]Saiyan-Bot> -={ Deleted NAVID's stats! }=-
and the files were still there.
Posted by: Collective

Re: removing files script problem. - 04/07/05 05:30 AM

Check your status window for errors

Make sure the files aren't in use.
Make sure you have access to delete the files.
Make sure you got the right file name.
Posted by: Navid

Re: removing files script problem. - 04/07/05 06:00 AM

I found out the problem. I had an alias remove with some other kind of information on it already from before. Sorry, but it worked, Thanks.
Just one more question
There is also another file called Memstats.dgt in the main mirc folder and one thats called registered.DGT and also in a file users.dgt (in this file its like a list, it has no topic. ex:
Navid
me
You
him
so do I use remove for them too?.
Sorry last question.


~Thanks
Posted by: SladeKraven

Re: removing files script problem. - 04/07/05 06:02 AM

If it contains all the users, are you should you'd like to remove the file? But yes, it can be done with /remove.

-Andy
Posted by: Navid

Re: removing files script problem. - 04/07/05 06:18 AM

okay I removed the users (with no extension file) to users.dgt no I dont want to delete everything from it I jsut wanna delete the $2. and $2 is not like a topic ie: [$2] its just a list. here is the code I use d to make the list:
Code:
/users {
  set %a 0
  :start
  inc %a 1
  set %b $read(Users.dgt,%a)
  if (%b == $null) { goto a }
  else { goto start }
  :a
  write Users.dgt $nick
}  


I just need to get rid of the line that $2 (user's nick) is in.

~Thanks
Posted by: SladeKraven

Re: removing files script problem. - 04/07/05 06:39 AM

Maybe something like:

write -dw $+("*,$2,*") file.txt

-Andy
Posted by: Navid

Re: removing files script problem. - 04/07/05 07:13 AM

That did the job, thanks Sladekraven. Just one last question how do you remove a complete folder?
I tried

remove Folder\
remove Folder
remove $+(Folder)

they didnt work, can ya show me how its done smile
Posted by: SladeKraven

Re: removing files script problem. - 04/07/05 07:21 AM

/rmdir Folder

This will only delete the folder, if it's empty.

-Andy
Posted by: DaveC

Re: removing files script problem. - 04/07/05 09:40 AM

Bring back DELTREE i say!