Raised This Month: $ Target: $400
 0% 

delete files with a specific prefix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
faki
Senior Member
Join Date: Jul 2013
Old 08-30-2013 , 06:12   delete files with a specific prefix
Reply With Quote #1

I need to delete some maps in my maps folder with amxx, i need to do that:
When maps is with czero_ prefix - delete automaticaly after XX seconds (by task)
Can someone help me?
faki is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2013 , 06:21   Re: delete files with a specific prefix
Reply With Quote #2

Explain instead what you want really to do, what is this czero_ maps, etc.
Because making a plugin to delete maps after X seconds doesn't make sense.
__________________
Arkshine is offline
faki
Senior Member
Join Date: Jul 2013
Old 08-30-2013 , 06:25   Re: delete files with a specific prefix
Reply With Quote #3

I hosting public servers but someone uploaded custom maps and i dont like this.
I need plugin to delete all maps with specific prefix
cz_
aim_
fy_
and etc...
After XX seconds (by task)
faki is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 08-30-2013 , 07:11   Re: delete files with a specific prefix
Reply With Quote #4

Try this: UNTESTED
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN_NAME "[AMXx] Delete Maps By Prefix" #define PLUGIN_VERSION "1.0" new const g_MapsPrefix[][] = {     "cscz_"     "aim_",     "fy_" }; new g_CvarDeleteTime; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, "DeagLe.Studio");         g_CvarDeleteTime = register_cvar("md_delete_time", "10.0");         set_task(get_pcvar_float(g_CvarDeleteTime), "Task_DeleteMaps"); } public Task_DeleteMaps() {     static MapName[32], CurrentMapName[32], Patch[64];     get_mapname(CurrentMapName, charsmax(CurrentMapName));         new Position, Length, Iterator;         while (read_dir("maps", Position++, MapName, charsmax(MapName), Length))     {         for (Iterator = 0; Iterator < sizeof g_MapsPrefix; Iterator++)         {             if (equal(MapName, g_MapsPrefix[Iterator], strlen(g_MapsPrefix[Iterator])) && !equal(MapName, CurrentMapName))             {                 formatex(Patch, charsmax(Patch), "maps/%s", MapName);                 delete_file(Patch);             }         }     } }

Last edited by TheDS1337; 08-30-2013 at 11:06.
TheDS1337 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2013 , 07:18   Re: delete files with a specific prefix
Reply With Quote #5

Are you going again to start to post random shit code ?

@faki, if you an hoster, what the hell you need a Pawn plugin ? Are you going to install this plugin on all servers ? And what about if admins remove the plugin ? This doesn't make sense, just do a bash script or something similar.
__________________
Arkshine 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 19:00.


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