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
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 #8

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
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-08-2008 , 15:26   Re: Delete some files VIA ftp dedi server
Reply With Quote #9

I don't think you are understanding him chris. He is asking for a plugin that will search all folders for any .ztmp files and delete them as they are found. He doesn't want to search just one folder, he wants all folders to be searched.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 #10

Quote:
Originally Posted by Roach View Post
It's kinda stupid to do it through HLDS.
Why?
Lee 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 00:31.


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