Raised This Month: $ Target: $400
 0% 

Recursive directory delete


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 09-28-2008 , 23:01   Recursive directory delete
Reply With Quote #1

I put this together, but it doesn't work >_<. I'll fool around with it later, but I want you guys to look at it and tell me what's wrong.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Recursive Delete Directory" #define VERSION "1.0" #define AUTHOR "stupok69" public plugin_init() {     register_plugin( PLUGIN, VERSION, AUTHOR )         register_concmd( "deldir", "cmd_delete" ) } public cmd_delete() {     new arg[64]     read_argv( 1, arg, 63 )         while( dir_exists( arg ) )     {         delete_dir_recursive( arg )     } } stock delete_dir_recursive( szFullPath[64] ) {     if( !dir_exists( szFullPath ) )         return 0         if( rmdir( szFullPath ) )         return 1         static dirh, szNextFile[sizeof szFullPath]         dirh = open_dir( szFullPath, szNextFile, sizeof szNextFile - 1 )     // szNextFile = " ."         next_file( dirh, szNextFile, sizeof szNextFile - 1 )     // szNextFile = ".."         while( next_file( dirh, szNextFile, sizeof szNextFile - 1 ) )     {         if( file_exists( szNextFile ) )         {             delete_file( szNextFile )         }         else if( dir_exists( szNextFile ) )         {             if( !rmdir( szNextFile ) )             {                 close_dir( dirh )                 delete_dir_recursive( szNextFile )             }         }     }         close_dir( dirh )         return 1 }
stupok is offline
 



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 23:54.


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