---
obj: application
repo: https://gitlab.com/KodyVB/tagctl
rev: 2025-01-30
---

# tagctl
Tagctl is a command line program which can add or remove tags to files.
The tags can either be in the name or under `user.xdg.tags` in the extended attributes.

## Usage
Usage: `tagctl [OPTIONS] [FILES]...`

| Option                                                | Description                                                                                                                                                                             |
| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-t, --tag <tag>`                                     | Tag to add/remove to selected files. `%p` uses the parent directory name, `%y` uses the modified year, `%m` uses modified month, `%d` uses modified day, and `%w` uses modified weekday |
| `-d, --delimiter <delimiter>`                         | Separator for multiple tags (default: `,`)                                                                                                                                              |
| `-i, --input`                                         | Accepts input from stdin                                                                                                                                                                |
| `-x, --xattr`                                         | Adds/removes tags via xattr under `user.xdg.tags`                                                                                                                                       |
| `-r, --remove`                                        | Removes tag instead of adding                                                                                                                                                           |
| `-R, --remove_all`                                    | Removes all tags                                                                                                                                                                        |
| `-v, --verbose`                                       | Increases verbosity of output                                                                                                                                                           |
| `-g, --generate_autocomplete <generate_autocomplete>` | The shell to generate auto-completion for `bash`, `elvish`, `fish`, `zsh`                                                                                                               |


## Examples
**Add tag `example` to current directory using file names:**
```shell
tagctl -t example "$(ls)"
ls | tagctl --input --tag example
```

**Remove tag `example` from current directory using file names:**
```shell
tagctl -r --tag=example "$(ls)"
ls | tagctl --remove -it example
```

**Add tag `example` to current directory using extended attributes:**
```shell
tagctl -xt example "$(ls)"
ls | tagctl --xattr --input --tag example
```

**Remove tag `example` from current directory using extended attributes:**
```shell
tagctl -xr --tag=example "$(ls)"
ls | tagctl --xattr --remove -it example
```

**Add tag `example` to two sets of inputs using file names:**
```shell
find /home/user/Documents | tagctl -it "example" "$(ls)"
```
