#!/usr/bin/bash root="root" all_files() { find $root -type f,l } for f in $(all_files) do install_path="${f#"$root"}" mkdir -p "$(dirname "$install_path")" # ln -snf "$PWD/$f" "$install_path" read -ra perm_options < <(stat -c '-m %a -g %g -o %u' "$PWD/$f") install -C "${perm_options[@]}" "$PWD/$f" "$install_path" done # vim: set filetype=bash: