summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2015-11-06 15:31:59 -0500
committerJune McEnroe <june@causal.agency>2015-11-06 15:31:59 -0500
commit0a51754928512e342167521dd70ea180ed5b7886 (patch)
treec128071387786acc66da349da3870ef3afa9281c
parentUpdate vendored Gruvbox colorscheme (diff)
downloadsrc-0a51754928512e342167521dd70ea180ed5b7886.tar.gz
src-0a51754928512e342167521dd70ea180ed5b7886.zip
Add prune script
-rw-r--r--README.md15
-rwxr-xr-xprune.sh12
2 files changed, 26 insertions, 1 deletions
diff --git a/README.md b/README.md
index 8f33fcd0..27a1e92f 100644
--- a/README.md
+++ b/README.md
@@ -13,14 +13,27 @@ My configuration files.
 
 ## Install
 
+Create symlinks in ~ for files in the current directory.
+
 ```
 ./install.sh
 ```
 
 ## Import
 
+Import a file from ~ and replace it with a symlink.
+
+```
+./import.sh .config
+```
+
+## Prune
+
+Remove symbolic links in ~ to files that no longer exist in the current
+directory.
+
 ```
-./import .config
+./prune.sh
 ```
 
 ## License
diff --git a/prune.sh b/prune.sh
new file mode 100755
index 00000000..2480b7ba
--- /dev/null
+++ b/prune.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Remove symbolic links in ~ to files that no longer exist.
+
+set -e
+
+paths=$(find -L ~ -type l -lname "$PWD/*")
+
+for path in $paths; do
+  rm $path
+  echo $path
+done