Created
June 28, 2017 12:09
-
-
Save tolleiv/36f2b198400362040850bd10bc5ae88f to your computer and use it in GitHub Desktop.
Minimal script to transform a list of files into the full tree with all parent folders (used to generate rsync-filters)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while read -r line ; do | |
DIR=$(dirname $line) | |
ORIG_IFS=$IFS | |
IFS='/' | |
subpath="" | |
for i in $DIR; do | |
subpath+="$i/" | |
echo "$subpath" | |
done | |
IFS= | |
echo "$line" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment