Raised This Month: $ Target: $400
 0% 

Delete some files VIA ftp dedi server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lolhax44
BANNED
Join Date: Jan 2008
Old 01-08-2008 , 10:55   Re: Delete some files VIA ftp dedi server
Reply With Quote #1

Quote:
Originally Posted by chris-1337 View Post
I think this code will work (any feedback is good, I haven't had time to test it):

Code:
#include <amxmodx>
#include <string>
#include <file>
public plugin_init()
{
  register_plugin("Delete File", "1.00", "chris-1337");
  set_task(30.0, "cmd_delfile", 33, "", 0, "b")
}
public cmd_delfile()
{
  new fname[65];
  new dirh = open_dir("sound/models/sprites/", fname, 64);
  while(next_file(dirh, fname, 64))
  {
    if(contain(fname, ".ztmp") != -1 && contain(fname, ".") != 0)
    {
      delete_file(fname);
    }
  }
  close_dir(dirh);
}
What if i said a load of files like scan every model /sprite / sound file to delete it what code would that be + karma if u create
lolhax44 is offline
chris-1337
Senior Member
Join Date: Jan 2008
Location: The United Kingdom Of Gr
Old 01-08-2008 , 12:07   Re: Delete some files VIA ftp dedi server
Reply With Quote #2

On the presumption the above code works:

Code:
#include <amxmodx>
#include <string>
#include <file>
public plugin_init()
{
  register_plugin("Delete File", "1.00", "chris-1337");
  set_task(30.0, "cmd_delfile", 33, "", 0, "b")
}
public cmd_delfile()
{
  cmd_deltype("sound/models/sprites/", ".ztmp");
}
public cmd_deltype(new directory[], new extension[])
{
  new fname[65];
  new dirh = open_dir(directory, fname, 64);
  while(next_file(dirh, fname, 64))
  {
    if(contain(fname, extension) != -1 && contain(fname, ".") != 0)
    {
      delete_file(fname);
    }
  }
  close_dir(dirh);
}
Then in the public function "cmd_delfile" just add the line of whatever directory & file tpye you want, like:

Code:
cmd_deltype("maps/", ".txt");
chris-1337 is offline
Send a message via MSN to chris-1337
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode