From bf1950578519d01e469e36b49fcdbbe2baf1d250 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 6 Nov 2015 15:31:59 -0500 Subject: Add prune script --- README.md | 15 ++++++++++++++- prune.sh | 12 ++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 prune.sh diff --git a/README.md b/README.md index 1ef1021e..e3aa75f9 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 -- cgit 1.4.1