{"id":16340726,"url":"https://github.com/casey/bak","last_synced_at":"2025-03-23T00:32:23.144Z","repository":{"id":45013971,"uuid":"206019676","full_name":"casey/bak","owner":"casey","description":"📦 Move files out of the way","archived":false,"fork":false,"pushed_at":"2022-01-11T22:42:33.000Z","size":12,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T15:49:03.724Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-03T07:48:02.000Z","updated_at":"2020-10-22T08:23:54.000Z","dependencies_parsed_at":"2022-09-24T21:31:39.548Z","dependency_job_id":null,"html_url":"https://github.com/casey/bak","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fbak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fbak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fbak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casey%2Fbak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casey","download_url":"https://codeload.github.com/casey/bak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245040235,"owners_count":20551297,"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","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":[],"created_at":"2024-10-10T23:57:39.042Z","updated_at":"2025-03-23T00:32:22.731Z","avatar_url":"https://github.com/casey.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bak\n\n[![crates.io](https://img.shields.io/crates/v/bak.svg)](https://crates.io/crates/bak) [![docs](https://docs.rs/bak/badge.svg)](http://docs.rs/bak)\n\n`bak` is a Rust library for safely moving files out of the way.\n\nThe API has a few methods, but the one to start with is\n`bak::move_aside(PATH)`.\n\n`move_aside(\"foo\")` will move the file or directory \"foo\" to\n\"foo.bak\", if there isn't already something there. If there is\nalready a file called \"foo.bak\", it will move it to \"foo.bak.0\", and\nso on.\n\n`move_aside()` returns an `io::Result\u003cPathBuf\u003e` containing the path\nto the renamed file.\n\nYou can call `move_aside_with_extension(PATH, EXTENSION)` if you'd\nlike to use an extension other than \"bak\". To see where a file would\nbe moved without actually moving it, call `destination_path(PATH)`\nor `destination_with_extension(PATH, EXTENSION)`.\n\n`bak` skips holes in sequences of backup files. For exmaple, if you\ncall `bak::move_aside(\"foo\")`, and \"foo.bak.12\" exists, bak will\nmove \"foo\" to \"foo.bak.13\".\n\n## caveats\n\n- If `bak` is in the middle of renaming a file from `foo` to\n  `foo.bak`, and another process or thread concurrently creates a\n  file called `foo.bak`, `bak` will silently overwrite the newly\n  created `foo.bak` with `foo`. This is because `bak` uses\n  `std::fs::rename`, which clobbers destination files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasey%2Fbak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasey%2Fbak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasey%2Fbak/lists"}