Raised This Month: $32 Target: $400
 8% 

copying files is very slow


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dordnung
Veteran Member
Join Date: Apr 2010
Old 01-04-2011 , 07:38   copying files is very slow
Reply With Quote #1

Hey, i use this code to copy files:

PHP Code:
public exlib_MoveFile(Handle:OldFileFileSizeString:FileName[])
{
    
decl String:FileContent[1024];
    
decl String:NewDir[PLATFORM_MAX_PATH 2];
    new 
Copyed 0;
    
    
Format(NewDirsizeof(NewDir), "maps/%s"FileName);
    new 
Handle:NewFile OpenFile(NewDir"wb");
    
    
PrintToServer("Move File %s (%i bytes) to %s ..."FileNameFileSizeNewDir);

    while (
Copyed FileSize
    {
        
PrintToServer("Copyed %i bytes"Copyed);
        
Copyed Copyed ReadFileString(OldFileFileContentsizeof(FileContent));
        
WriteFileString(NewFileFileContentfalse);
    }
    
    
PrintToServer("Copyed %i bytes"Copyed);
    
    
CloseHandle(NewFile);
    
CloseHandle(OldFile);

I'll copied a 22mb file, and it needed a lot of time (3 minutes?)
__________________
dordnung is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 01-04-2011 , 12:48   Re: copying files is very slow
Reply With Quote #2

If you close and open the file every 1023 cells, and that with 22 x 1024 x 1024 x 8 bits of information ... its bound to happen.


You should try some extension and copy the file using system commands

Last edited by AtomicStryker; 01-04-2011 at 13:25.
AtomicStryker is offline
Reply


Thread Tools
Display Modes

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 03:52.


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