Back

CopyFile

JS Py
Hello World

CopyFile copies a file to a given destination.

app.CopyFile( source, destination )

The target must locate to the actual target file, not the folder. An existing file will be overridden.

See Also: RenameFile, DeleteFile, FileExists

Example - Copy file

function OnStart()
{
    app.WriteFile( "myFile.txt", "Hello World from Write\n", "Append" );

    app.CopyFile("myFile.txt", "/sdcard/myFile.txt");

    if(app.FolderExists("/sdcard/myFile.txt"))
        app.ShowPopup("myFile exists in /sdcard/!");
    else
        app.ShowPopup("myFile does not exist in /sdcard/!");
}
from native import app

def OnStart():
    app.WriteFile( "myFile.txt", "Hello World from Write\n", "Append" )

    app.CopyFile("myFile.txt", "/sdcard/myFile.txt")

    if app.FolderExists("/sdcard/myFile.txt"):
        app.ShowPopup("myFile exists in /sdcard/!")
    else:
        app.ShowPopup("myFile does not exist in /sdcard/!")
    Copy     Copy All       Run      
String: path to file or folder ( “/absolute/...” or “relative/...” )