File copy

Command :

Copy/ [Source file], [Destination file] {/Progression:[Variable1] /Bytes:[Variable2] /BytesBySec:[Variable3]}

Visual overview :


Functionality :

This command allow to copy a file. This embark statistics functionality (Progression in %, wrote bytes, wrote bytes by seconds)


Avaiable parameters :

  • Define variable who will contain progression in %

    /PROGRESSION:variable1

  • Define variable who will contain bytes wrote

    /BYTES:variable2

  • Define variable who will contain bytes wrote by seconds

    /BYTESBYSEC:variable3


Examples :

Example 1

Copy in current directory

Copy/ File1.cpc, File2.cpc

Example 2

Copy a file from directory to another directory

Copy/ MyFolder/file1.txt, MyFolder/file2.log

Example 3

Copy a big file in another thread and display the progression% to the console.

CMD/ /Thread Copy/ file1.mp4, file2.mp4 /Progression:Value1

And type to the console

txt/ %Value1%

Example 4

Copy a big file in another thread and display statistics to the screen
Write this on a .CPC file

// Launch the copy to another thread
cmd/ /thread Copy/ file1.mp4, fil2.mp4 /Progression:Value1 /Bytes:Value2 /BytesBySec:Value3

// Sleep 1 sec, wait that previous new thread creates variables (value1, value2, value3)
ccp/ /sleep:1000
:begin:

// Display progression
txt/ Progression:%Value1%\% wrote:%Value2% mo Speed:%Value3%/s kb/s

// If we are to "100", we exit program
if/ "%Value1%" == "100" then:
    txt/ Ending
    stop/
end/ if

// Loop!
Goto/ begin

Example 5

IDEM but more perfectionned!


// Launch the copy to another thread
cmd/ /thread Copy/ file1.mp4, fil2.mp4 /Progression:Value1 /Bytes:Value2 /BytesBySec:Value3

// Sleep 1 sec, wait that previous new thread creates variables (value1, value2, value3)
ccp/ /sleep:1000
:begin:

// Convert bytes numbers to mega-bytes
Set/ Write = /C((%Value2% / 1024) / 1024)

// Convert to integer
Set/ Write = /f:CPC.Integer(%Write%)

// Convert speed to kilo-bytes
Set/ Speed = /c(%Value3% / 1024)

// Getting Y position
@#PositionY Pos/ y

// Monter d'une ligne
Set/ PositionY = /c(%PositionY - 1)

// Repositionner Y
pos/ y:%PositionY%

// Display progression to the screen
txt/ Progression:%Value1%\% Wrote:%Value2% mo Speed:%Value3%/s ko/s

// If we are to "100", we exit program
if/ "%Value1%" == "100" then:
    txt/ Ending
    stop/
end/ if

// Loop !
Goto/ begin