Skip to content

Instantly share code, notes, and snippets.

@tolleiv
Created June 28, 2017 12:09
Show Gist options
  • Save tolleiv/36f2b198400362040850bd10bc5ae88f to your computer and use it in GitHub Desktop.
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)
#!/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