DEV Community

loading...

How to move a file or folder to trash in Java?

vijaysrj profile image Vijay SRJ ・1 min read

You can move a file or a folder to trash/ recycle bin in java using the below code:

`Desktop.getDesktop().moveToTrash()'

Here is a demo:

https://fullstackdeveloper.guru/2021/04/29/how-to-move-a-file-folder-to-trash-recyclebin-in-java/

Discussion (0)

Forem Open with the Forem app