{"id":17526513,"url":"https://github.com/reugn/fsweeper","last_synced_at":"2025-04-15T04:32:19.592Z","repository":{"id":46540451,"uuid":"271737221","full_name":"reugn/fsweeper","owner":"reugn","description":"A file management automation tool","archived":false,"fork":false,"pushed_at":"2021-10-06T05:56:46.000Z","size":79,"stargazers_count":31,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T10:15:18.719Z","etag":null,"topics":["automation","cli","command-line-tool","document-management","file-manager","filemanager","filesystem","organizer"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reugn.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}},"created_at":"2020-06-12T07:31:13.000Z","updated_at":"2024-04-22T12:37:25.000Z","dependencies_parsed_at":"2022-08-27T19:01:14.647Z","dependency_job_id":null,"html_url":"https://github.com/reugn/fsweeper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reugn%2Ffsweeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reugn%2Ffsweeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reugn%2Ffsweeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reugn%2Ffsweeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reugn","download_url":"https://codeload.github.com/reugn/fsweeper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249006570,"owners_count":21197299,"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":["automation","cli","command-line-tool","document-management","file-manager","filemanager","filesystem","organizer"],"created_at":"2024-10-20T15:01:50.857Z","updated_at":"2025-04-15T04:32:19.574Z","avatar_url":"https://github.com/reugn.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# FSweeper\n\u003cimg src=\"docs/images/fsweeper.png\" align='right'/\u003e\n\n[![Build](https://github.com/reugn/fsweeper/actions/workflows/build.yml/badge.svg)](https://github.com/reugn/fsweeper/actions/workflows/build.yml)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/reugn/fsweeper)](https://pkg.go.dev/github.com/reugn/fsweeper)\n[![Go Report Card](https://goreportcard.com/badge/github.com/reugn/fsweeper)](https://goreportcard.com/report/github.com/reugn/fsweeper)\n\nAn intuitive and simple file management automation tool.  \nRead this guide and write rules for organizing file storage in just a couple of minutes.\n\n## Installation\nPick a binary from the [releases](https://github.com/reugn/fsweeper/releases).\n\n### Build from source \nDownload and install Go https://golang.org/doc/install.\n\nGet the package:\n```sh\ngo get github.com/reugn/fsweeper\n```\n\nRead this [guide](https://golang.org/doc/tutorial/compile-install) on how to compile and install the application.\n\n## Usage\nCommand line options list:\n```\n./fsweeper --help\n\nUsage of ./fsweeper:\n  -actions\n        Show supported actions\n  -conf string\n        Configuration file path (default \"conf.yaml\")\n  -configure\n        Open default configuration file in $EDITOR\n  -filters\n        Show supported filters\n  -version\n        Show version\n```\n\n## Configuration\n`fsweeper` uses YAML as a configuration file format.  \nA default configuration file name could be set using the `FSWEEPER_CONFIG_FILE` environment variable. It will fallback to `conf.yaml` otherwise.  \nUse `--conf=custom.yaml` parameter to run against a custom configuration file.  \n\nLet's start with a simple example:\n```yaml\nrules:\n    - path: ./examples/files\n      recursive: true\n      op: OR\n      actions:\n        - action: echo\n          payload: \"Found size\"\n      filters:\n        - filter: size\n          payload: gt 10000\n        - filter: size\n          payload: eq 0\n```\nThis configuration will look for files that are bigger than 10000 bytes or empty and print out \"Found size\" message on each.\n\nWhat if we want to move all JSON files to an archive folder:\n```yaml\nrules:\n    - path: ./examples/files\n      recursive: true\n      actions:\n        - action: move\n          payload: ./examples/archive\n        - action: echo\n          payload: \"Found JSON file\"\n      filters:\n        - filter: ext\n          payload: .json\n```\n\n### Variables and pipelines\nWe can build dynamic configurations using variables and pipelines.\nVariables introduce a set of dynamic placeholders to be substituted in runtime.\nPipelines chain together a series of template commands to compactly express a series of transformations.\n\nLet's see an example:\n```yaml\nvars:\n    dateTimeFormat: \"2006.01.02[15-04-05]\"\nrules:\n    - path: ./examples/files\n      recursive: true\n      op: AND\n      actions:\n        - action: echo\n          payload: \"Found {{ .FileName | upper | quote }} at {{ .DateTime }}, size {{ .FileSize }}\"\n      filters:\n        - filter: name\n          payload: \"[0-9]+\"\n        - filter: contains\n          payload: \"1234\"\n```\n\n| Variables   | Description |\n| ----------- | --- |\n| `.FileSize` | Returns the context file size |\n| `.FileName` | Returns the context file name |\n| `.FilePath` | Returns the context file full path |\n| `.FileExt`  | Returns the context file extension |\n| `.Time`     | Current Time (default format: \"15-04-05\")\u003csup\u003e[1](#format)\u003c/sup\u003e | \n| `.Date`     | Current Date (default format: \"2006-01-02\")\u003csup\u003e[1](#format)\u003c/sup\u003e |\n| `.DateTime` | Current DateTime (default format: \"2006-01-02[15-04-05]\")\u003csup\u003e[1](#format)\u003c/sup\u003e |\n| `.Ts`       | Current Unix epoch time |\n\n\u003csup name=\"format\"\u003e1\u003c/sup\u003eYou can override `timeFormat`, `dateFormat`, and `dateTimeFormat` in the configuration file.\n\n| Pipeline functions | Description |\n| -------- | --- |\n| `trim`   | Removes leading and trailing white spaces |\n| `upper`  | Returns a string with all Unicode letters mapped to their upper case |\n| `lower`  | Returns a string with all Unicode letters mapped to their lower case |\n| `quote`  | Wraps a string with double quotes |\n| `head n` | Takes the first \"n\" characters of the input string |\n| `len`    | Returns a string representation of the input length |\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freugn%2Ffsweeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freugn%2Ffsweeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freugn%2Ffsweeper/lists"}