Snippet. Vala. Moving File to Trash BinThis Vala snippet shows how to move a file to the trash/recycle bin.
var file = File.new_for_path("filename.txt");
try {
if(file.query_exists() == true){
file.trash();
}
} catch (Error e) {
stderr.printf ("Error: %s\n", e.message);
}
Updated on: 06 Dec 2025 |
|
|