diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-12-05 13:49:22 -0500 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-12-05 13:49:22 -0500 |
| commit | f8d09c5cfd6d1d9595b64547dc9d29c63e40c5f2 (patch) | |
| tree | 0dd9cfa47cfa0bd4d57d7789439cc86afbbdfa85 /util | |
| parent | 29b1c791f6e319cdab828cee5f491ca1c38e41d1 (diff) | |
Moved .local/bin to scripts
Diffstat (limited to 'util')
| -rwxr-xr-x | util | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#!/bin/zsh + +set -o shwordsplit + +log() { + if [[ $dry == "1" ]]; then + echo "[DRY_RUN]: $1" + else + echo "$1" + fi +} + +execute() { + log "execute $@" + if [[ $dry == "1" ]]; then + return + fi + "$@" +} + +copy_dir() { + from=$1 + to=$2 + pushd $from + dirs="$(find . -maxdepth 1 -mindepth 1 -type d)" + for dir in $dirs; do + execute rm -rf $to/$dir + execute cp -r $dir $to/$dir + done + popd +} + +copy_file() { + from=$1 + to=$2 + name=$(basename $from) + + execute rm $to/$name + execute cp $from $to/$name +} + |
