Symlink Exclude
von linuxCowboy- SNIPPET_DESC:
- script
- SNIPPET_CREATION_TIME:
- 02.07.2015 21:57:55
- SNIPPET_PRUNE_TIME:
- Unendlich
- SNIPPET_TEXT:
-
- #!/bin/bash
- target=${1-/home/csgo/game/output} # param 1
- cs=${2-/home/csgo/game/csgo-deagle1} # param 2
- mkdir -p "$target"
- [[ ! -d $cs || ! -d $target ]] && echo "not 2 dirs" && exit 1
- find "$cs" -type f |
- while read f; do
- filepath=$f
- [[ $filepath =~ ^\.*/(.*) ]] && filepath=${BASH_REMATCH[1]}
- if [[ $filepath =~ / ]]; then
- filepath=${filepath%/*}
- else
- filepath=
- fi
- mkdir -p "${target%/}/$filepath"
- if [[
- $f == *.conf ||
- $f == *.cfg ||
- $f == *txt ||
- $f == *.ini ||
- $f == *.smx ||
- $f == *.mp3 ||
- $f == *.sh
- ]]; then
- echo -n "copy: "
- cp -v "$f" "${target%/}/$filepath"
- else
- echo -n "link: "
- ln -sfv "$f" "${target%/}/$filepath"
- fi
- done | sort
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN