Raised This Month: $51 Target: $400
 12% 

[STOCK] AddFolderToDownloadTable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fredd
Veteran Member
Join Date: Jul 2007
Old 04-06-2008 , 19:40   [STOCK] AddFolderToDownloadTable
Reply With Quote #1

simply adds all of the contents(just files) of a folder to the download table...requires sdktools.
Code:
stock AddFolderToDownloadTable(const String:Directory[], bool:recursive=false) {     decl String:FileName[64], String:Path[512];     new Handle:Dir = OpenDirectory(Directory), FileType:Type;     while(ReadDirEntry(Dir, FileName, sizeof(FileName), Type))     {         if(Type == FileType_Directory && recursive)         {             FormatEx(Path, sizeof(Path), "%s/%s", Directory, FileName);             AddFolderToDownloadTable(FileName);             continue;         }                 if (Type != FileType_File)             continue;                 FormatEx(Path, sizeof(Path), "%s/%s", Directory, FileName);         AddFileToDownloadsTable(Path);     }     return; }
hi sawce
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!

Last edited by Fredd; 04-07-2008 at 02:50.
Fredd is offline
pRED*
Join Date: Dec 2006
Old 04-07-2008 , 02:04   Re: [STOCK] AddFolderToDownloadTable
Reply With Quote #2

Code:
stock AddFolderToDownloadTable(const String:Directory[]) {     decl String:FileName[64], String:Path[512];     new Handle:Dir = OpenDirectory(Directory), FileType:Type;     while(ReadDirEntry(Dir, FileName, Type)     {         if(Type == FileType_Folder)         {             Format(FileName, sizeof(FileName), "%s/%s", Directory, FileName);             AddFolderToDownloadTable(FileName);             continue;         }                 if (Type != FileType_File)         {             continue;         }                     Format(Path, sizeof(Path), "%s/%s", Directory, FileName);         AddFileToDownloadsTable(Path);     }     return; }

Hi Fredd. Untested.
pRED* is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 04-07-2008 , 02:50   Re: [STOCK] AddFolderToDownloadTable
Reply With Quote #3

thx edited..
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd 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 02:16.


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