From b9827360457a00243c62e27e55be8053cc9cd5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Thu, 13 Dec 2018 10:49:51 -0800 Subject: [PATCH] Handle the paths in a way theat the resulting directory is relative to the last directory in the path instead of using the full path. --- bash/ghostmirror.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bash/ghostmirror.sh b/bash/ghostmirror.sh index ee64c37..e4bfd93 100755 --- a/bash/ghostmirror.sh +++ b/bash/ghostmirror.sh @@ -1 +1,5 @@ -find "$1"/ -type d -exec mkdir -p "$2"/{} \; -o -type f -exec touch "$2"/{} \;; +orig_dir=$(pwd) +path=$(dirname $1) +dirname=$(basename $1) +cd $path; +find "$dirname"/ -type d -exec mkdir -p "$2"/{} \; -o -type f -exec touch "$2"/{} \;;