aboutsummaryrefslogtreecommitdiff
path: root/_tils/2020-11-08-find-broken-symlinks-with-find.md
blob: 7912df0e9923086b43aceba72fb598b88daf5e86 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---

title: Find broken symlinks with "find"

date: 2020-11-08

layout: post

lang: en

ref: find-broken-symlinks-with-find

---

The `find` command knows how to show broken symlinks:

```shell
find . -xtype l
```

This was useful to me when combined with [Git Annex][git-annex]. Its
[`wanted`][git-annex-wanted] option allows you to have a "sparse" checkout of
the content, and save space by not having to copy every annexed file locally:

```shell
git annex wanted . 'exclude=Music/* and exclude=Videos/*'
```

You can `find` any broken symlinks outside those directories by querying with
Git Annex itself, but `find . -xtype l` works on other places too, where broken
symlinks might be a problem.

[git-annex]: https://git-annex.branchable.com/
[git-annex-wanted]: https://git-annex.branchable.com/git-annex-wanted/