Back

DeleteFile

JS Py
Hello World

DeleteFile deletes a given file from the filesystem.

app.DeleteFile( file )

This makes it hard to restore it!

See Also: WriteFile, RenameFile, FileExists

Example - Delete created file

function OnStart()
{
    app.WriteFile( "myFile.txt", "Bye World!\n", "Append" );

    app.DeleteFile("myFile.txt");

    if(app.FileExists("myFile.txt"))
        app.ShowPopup("myFile was not deleted!");
    else
        app.ShowPopup("myFile was deleted!");
}
def OnStart():
    app.WriteFile( "myFile.txt", "Bye World!\n", "Append" )

    app.DeleteFile("myFile.txt")

    if app.FileExists("myFile.txt"):
        app.ShowPopup("myFile was not deleted!")
    else:
        app.ShowPopup("myFile was deleted!")
    Copy     Copy All       Run      
String: path to file ( “/absolute/...” or “relative/...” )