{"id":19999358,"url":"https://github.com/bios-marcel/wastebasket","last_synced_at":"2025-09-10T02:47:00.057Z","repository":{"id":34412722,"uuid":"146635631","full_name":"Bios-Marcel/wastebasket","owner":"Bios-Marcel","description":"A crossplatform go library for moving files to the trashbin","archived":false,"fork":false,"pushed_at":"2025-04-08T07:37:49.000Z","size":397,"stargazers_count":36,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-13T01:53:38.986Z","etag":null,"topics":["delete","go","golang","linux","macos","recyclebin","remove","trash","trashbin","windows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bios-Marcel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-29T17:33:18.000Z","updated_at":"2025-06-17T03:02:46.000Z","dependencies_parsed_at":"2023-01-16T23:00:15.521Z","dependency_job_id":"27a2f7d3-f74c-4de0-8d78-27daf411fa58","html_url":"https://github.com/Bios-Marcel/wastebasket","commit_stats":{"total_commits":136,"total_committers":3,"mean_commits":"45.333333333333336","dds":0.08088235294117652,"last_synced_commit":"9ffca06a69d00da279227f3a0ddba5a4c9701c76"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Bios-Marcel/wastebasket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bios-Marcel%2Fwastebasket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bios-Marcel%2Fwastebasket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bios-Marcel%2Fwastebasket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bios-Marcel%2Fwastebasket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bios-Marcel","download_url":"https://codeload.github.com/Bios-Marcel/wastebasket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bios-Marcel%2Fwastebasket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271424922,"owners_count":24757365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delete","go","golang","linux","macos","recyclebin","remove","trash","trashbin","windows"],"created_at":"2024-11-13T05:11:31.303Z","updated_at":"2025-08-21T04:30:34.056Z","avatar_url":"https://github.com/Bios-Marcel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wastebasket\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/Bios-Marcel/wastebasket.svg)](https://pkg.go.dev/github.com/Bios-Marcel/wastebasket)\n[![CI](https://github.com/Bios-Marcel/wastebasket/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/Bios-Marcel/wastebasket/actions/workflows/test.yml)\n[![codecoverage](https://codecov.io/gh/Bios-Marcel/wastebasket/branch/master/graph/badge.svg?token=yy8qX4BQbT)](https://codecov.io/gh/Bios-Marcel/wastebasket)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/logo.png\" width=512 height=512/\u003e\n\u003c/p\u003e\n\nWastebasket is a go library / CLI tool allowing you to interact with your\nsystem trashbin. It supports nix-systems (such as Linux and BSD) and Windows.\n\n## Documentation\n\nFurther documentation can be found at [/docs](/docs).\n\n## Dependencies\n\n### Golang\n\nFor `v2`, go 1.23.4 or newer is required. For go 1.18 and up use the old\nimplementation.\n\n### MacOS\n\nNote that `github.com/Bios-Marcel/wastebasket/v2` only supports MacOS patially.\nI simply can't be bothered maintaining it, as the performance is horrible and\nadding features is hard to test. Additionally, a \"proper\" implementation\nrequires a very complex solution, that according to research won't work\nreliable. For now, we are stuck calling finder.\n\nIt's recommended to not call the `Trash` functon in a tight loop, put some\n`time.Sleep` calls, as the finder noise will sound very painful and cause your\ndevice to lag.\n\nRestoring and querying files is not possible as of now.\n\nIF you are willing to contribute and potentially maintain a proper MacOS\nimplementation, I'd be glad to accept a PR.\n\n### Windows\n\nThere are no dependencies, it depends on the Shell32 API built into Windows.\n\n**No CGO required**\n\n### Linux (Unix)\n\nThere are no dependencies, as Wastebasket offers a native golang implementation\nof the [FreeDesktop Trash specification](https://specifications.freedesktop.org/trash-spec/trashspec-latest.html).\n\nAdditionally, the custom implementation should also work for systems such\nas BSD and its derivatives. However, this has not been tested and I do not\nplan on doing so, simply because GitHub does not currently support running\ntests on any BSD derivatives.\n\nIf anyone is willing to host a custom runner (which I think is possible), then\nI'd be open to this though.\n\n**No CGO required**\n\n## Library usage\n\nGrab it via\n\n```bash\ngo get github.com/Bios-Marcel/wastebasket/v2\n```\n\nand you are ready to go.\n\nMinimal Go example that creates a file, deletes it and empties the trashbin:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"os\"\n\n    \"github.com/Bios-Marcel/wastebasket/v2\"\n)\n\nfunc main() {\n    os.WriteFile(\"test.txt\", []byte(\"Test\"), os.ModePerm)\n    fmt.Println(wastebasket.Trash(\"test.txt\"))\n    wastebasket.Empty()\n}\n```\n\nMake sure to check for `ErrPlatformNotSupported` if you are deploying to MacOS\nor nieche systems.\n\n## CLI usage\n\n**UNSTABLE, USE AT YOUR OWN RISK**\n\nWastebasket can also be used as a commandline interface. You can build\nexecutables for each subcommand (such as `empty`) separately, or build\n`wastebasket` as a whole.\n\nIn order to do so, run\n\n```shell\ngo build ./cmd/CMD\n```\n\nwhere `CMD` is whichever command you want to build.\n\n### Autocompletion\n\nThe CLI offers autocompletion for flags and pre-defined arguments.\n\nBash; Write the following into your bash profile:\n\n```bash\nsource \u003c(wastebasket completion bash)\n```\n\nAdditionally, completion is supported for zsh, powershell and fish.\nFor information, see [Cobra shell completions](https://github.com/spf13/cobra/blob/main/shell_completions.md)\n\n## Tests\n\nFor windows, there is a utility that allows you to run linux or windows tests\nusing containers. This prevents the utilitiy from accidentally deleting files or\nemptying your trashbin.\n\nSimply execute:\n\n```powershell\ntest \u003clinux|windows\u003e\n```\n\nNote that this doesn't work when you are on linux.\n\n## Benchmarks\n\nRun benchmarks using:\n\n```go\ngo test -bench=.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbios-marcel%2Fwastebasket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbios-marcel%2Fwastebasket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbios-marcel%2Fwastebasket/lists"}