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-06-2008 , 17:16   Delete some files VIA ftp dedi server
Reply With Quote #1

Delete some files VIA ftp dedi server

delete .ztmp

Because its taking up nearly a load of space and its annoying to see it in sound/models/sprites

.amxx plugin i have searched but i cant find
lolhax44 is offline
chris-1337
Senior Member
Join Date: Jan 2008
Location: The United Kingdom Of Gr
Old 01-07-2008 , 12:41   Re: Delete some files VIA ftp dedi server
Reply With Quote #2

Here you go:

Code:
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
  register_plugin("Delete File", "1.00", "chris-1337");
  register_concmd("amx_delfile", "cmd_delfile", ADMIN_RCON, "- delete specified file");
}
public cmd_delfile(id, level, cid)
{
  if(cmd_access(id, level, cid, 1))
  {
    new ftd[65];
    read_argv(1, ftd, 64);
    delete_file(ftd);
  }
  return PLUGIN_HANDLED;
}
I am pretty sure that:
amx_delfile "sound/models/sprites/THISFILE.ztmp"
will delete it for you.

Last edited by chris-1337; 01-07-2008 at 13:32. Reason: adding extra comment
chris-1337 is offline
Send a message via MSN to chris-1337
lolhax44
BANNED
Join Date: Jan 2008
Old 01-07-2008 , 15:23   Re: Delete some files VIA ftp dedi server
Reply With Quote #3

Nah i wanted one that searches them and then deletes them every 30 seconds
lolhax44 is offline
Howdy!
Senior Member
Join Date: Feb 2007
Old 01-07-2008 , 17:52   Re: Delete some files VIA ftp dedi server
Reply With Quote #4

Quote:
Originally Posted by chris-1337 View Post
Here you go:

Code:
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
  register_plugin("Delete File", "1.00", "chris-1337");
  register_concmd("amx_delfile", "cmd_delfile", ADMIN_RCON, "- delete specified file");
}
public cmd_delfile(id, level, cid)
{
  if(cmd_access(id, level, cid, 1))
  {
    new ftd[65];
    read_argv(1, ftd, 64);
    delete_file(ftd);
  }
  return PLUGIN_HANDLED;
}
I am pretty sure that:
amx_delfile "sound/models/sprites/THISFILE.ztmp"
will delete it for you.
1st: Hello to 08 member.
2nd: for the code.
__________________
[IMG]http://img221.**************/img221/5608/howdyfinnishhq2.jpg[/IMG]
Howdy! is offline
Roach
Writes love letters to sawce Daily
Join Date: Jul 2006
Location: Internet
Old 01-07-2008 , 23:13   Re: Delete some files VIA ftp dedi server
Reply With Quote #5

Wow...that code just blew my mind.

Good attempt though...we all gotta start somewhere.

I am so lost here, you want a plugin to delete a .ztmp file from inside the rcon console? Why have HLDS do it? If your box is managed by a server provider, ask them to build a simple script to run every x number of map changes to delete the .ztmp files from a specified directory. It's kinda stupid to do it through HLDS.
__________________
Quote:
Originally Posted by Brad View Post
That sounds like a really good idea!
Now replace the word "good" with "dumb".
What was your rationale for proposing such a thing?
Roach is offline
chris-1337
Senior Member
Join Date: Jan 2008
Location: The United Kingdom Of Gr
Old 01-08-2008 , 03:35   Re: Delete some files VIA ftp dedi server
Reply With Quote #6

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);
}
chris-1337 is offline
Send a message via MSN to chris-1337
lolhax44
BANNED
Join Date: Jan 2008
Old 01-08-2008 , 10:55   Re: Delete some files VIA ftp dedi server
Reply With Quote #7

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
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 01-08-2008 , 15:42   Re: Delete some files VIA ftp dedi server
Reply With Quote #8

Quote:
Originally Posted by Roach View Post
It's kinda stupid to do it through HLDS.
Why?
Lee is offline
chris-1337
Senior Member
Join Date: Jan 2008
Location: The United Kingdom Of Gr
Old 01-08-2008 , 15:56   Re: Delete some files VIA ftp dedi server
Reply With Quote #9

Not completely sure how to go through all directories & sub-directories, however anyone else is free to take my code, I suggest in the public function "public cmd_delfile" the loop is run and then "public cmd_deltype" is run.
chris-1337 is offline
Send a message via MSN to chris-1337
Roach
Writes love letters to sawce Daily
Join Date: Jul 2006
Location: Internet
Old 01-08-2008 , 23:26   Re: Delete some files VIA ftp dedi server
Reply With Quote #10

Quote:
Originally Posted by Lee View Post
Why?
Why make HLDS work harder than it has to? Why not just let the filesystem of the box itself delete the files? I could see a drop in performance because HLDS is indexing and searching its folders for .ztmp files while trying to run the normal server operations and anything else. Dunno how much of a drop, but it is possible.

JM2c.
__________________
Quote:
Originally Posted by Brad View Post
That sounds like a really good idea!
Now replace the word "good" with "dumb".
What was your rationale for proposing such a thing?
Roach is offline
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