https://github.com/freeslave/trashcan
Move files to trash can in D programming language
https://github.com/freeslave/trashcan
d dlang freedesktop recycle-bin trashcan
Last synced: 5 months ago
JSON representation
Move files to trash can in D programming language
- Host: GitHub
- URL: https://github.com/freeslave/trashcan
- Owner: FreeSlave
- License: bsl-1.0
- Created: 2016-06-21T19:17:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-07-18T10:41:41.000Z (almost 2 years ago)
- Last Synced: 2025-01-22T14:45:42.562Z (over 1 year ago)
- Topics: d, dlang, freedesktop, recycle-bin, trashcan
- Language: D
- Homepage:
- Size: 168 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE_1_0.txt
Awesome Lists containing this project
README
# Trash can
[](https://github.com/FreeSlave/trashcan/actions/workflows/ci.yml)
[](https://ci.appveyor.com/project/FreeSlave/trashcan)
Trash can operations implemented in D programming language.
The **moveToTrash** function places a passed file or directory to trash can. The **Trashcan** class allows to list trashcan contents, restore or delete items.
[Online documentation](https://freeslave.github.io/trashcan/trashcan.html)
## Platform support and implementation details
On Freedesktop environments (e.g. GNU/Linux) the library follows [Trash Can Specification](https://www.freedesktop.org/wiki/Specifications/trash-spec/).
On Windows [SHFileOperation](https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationw) is used to move files to trash, and [IShellFolder2](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ishellfolder2) is used as an interface to recycle bin to list, delete and undelete items.
On OSX FSMoveObjectToTrashSync is used to move files to trash. Listing, deleting and undeleting items in the trash can are not currently supported on macOS.
Other platforms are not supported.
## Currently missing features
* Notifying changes in trash can contents (or at least providing the data required to implement this feature for the library user).
## Examples
### [Put to trash can](examples/put.d)
Run to put file or directory to trash can:
dub examples/put.d path/to/file
### [Manage items in trash can](examples/manage.d)
Interactively delete items from trashcan or restore them to their original location.
dub examples/manage.d