File_Copy()

Parent Previous Next

Syntax

File_Copy(pSourceName As String * 13, bSourcePartition As Byte, ByRef pSourcePath As Dword, pDestName As String * 13, bDestPartition As Byte, ByRef pDestPath As Dword), Byte

Parameters

pSourceName — file's name to be copied

bSourcePartition  — partition number where the file resides

pSourcePath — source string buffer array — a string variable is required here, since ByRef passes its address automatically

pDestName           — new destination file name 

bDestPartition       — partition number where the file will be copied to

pDestPath     — destination string buffer array — a string variable is required here, since ByRef passes its address automatically


Return value — cErrOK = success

            cErrNotFound = source file or a directory path missing

            cErrExists = destination already exists

            cErrInvalidPath = bad partition number

cErrRWError

       

Copies a file between any two partitions and/or directories


Copies a file between any two partitions and/or directories, chunk by chunk. pSourcePath/pDestPath are directory paths (e.g.
"photos/2024"), passed the same way as File_MkPath()/File_SetPath() - pass an empty string for root.


Every partition switch resets to root so both paths are re-walked before every file operation which adds overhead.
To speed up the copy process you can increase the copy buffer size by changing the "baCopyBufferSize" declaration in Fat.inc, but this will add more RAM usage, currently set to 64 bytes (Symbol baCopyBufferSize = 64)


Restores whichever partition was active before this call on exit. 

Example

    Dim sTemp As String * 20        'Create string array variable

    Dim sTemp1 As String * 20       'Create string array variable

    File_ListPartitions()           'Detect partitions     

    File_SetPartition(2)            'Set currently active partition 2

    sTemp = "my/home"               'Place some path in this string variable

    sTemp1 = "is/here"              'Place some path in this string variable

    'Copy "po.txt" from partition 4 sub folders my/home

    'as "fo.txt" to partition 3 Sub folders is/here

    File_Copy("po.txt",4,sTemp,"fo.txt",3,sTemp1)

Created with the Personal Edition of HelpNDoc: Produce Kindle eBooks easily