Sinisterly
[VB.Net] Copy API - Copy files faster - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: [VB.Net] Copy API - Copy files faster (/Thread-VB-Net-Copy-API-Copy-files-faster)



[VB.Net] Copy API - Copy files faster - 1234hotmaster - 02-17-2011

Code:
Code:
Public Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long



Usage:
Code:
CopyFile("C:\file.exe", "C:\file2.exe")



Got any problems ask me Smile
Spoiler: Credits
Credits go to Microsoft



RE: [VB.Net] Copy API - Copy files faster - 1llusion - 02-17-2011

I think I love you =D was just thinking how to do this =) wanted to use batch code =D

Big thanks!!!


RE: [VB.Net] Copy API - Copy files faster - 1234hotmaster - 02-17-2011

Well, your welcome i thought i share this cause i use this in my worm Smile


RE: [VB.Net] Copy API - Copy files faster - 1llusion - 02-17-2011

(02-17-2011, 07:30 PM)1234hotmaster Wrote: Well, your welcome i thought i share this cause i use this in my worm Smile

Yeh =) well I might use it in my bot =D


RE: [VB.Net] Copy API - Copy files faster - Coder-san - 02-18-2011

Well, file-transfer speed depends on your HDD spin-rate or SSD's max transfer-speed. What this API is offering here is the copy code in the raw form, which would be good but not really noticeable.

Full API with description

If you leave the bFailIfExists Boolean, it is the same as:
Code:
FileCopy(source, destination) 'Or IO.File.Copy(source, destination)

If you are looking to squeeze out performance, then reduce string concatenations (& or +) in your code, especially in Loops. That will make your Loops faster. Smile