Created
February 21, 2014 13:37
-
-
Save sambatyon/9134348 to your computer and use it in GitHub Desktop.
Extracts headers from a source tree.
This file contains 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/bash | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Usage: extractheaders src dest" | |
exit | |
fi | |
orig_dir=`pwd` | |
origin=$1 | |
if [[ "$2" = /* ]]; then | |
destination=$2 | |
else | |
destination=`pwd`/$2 | |
fi | |
rsync -a -f"+ */" -f"- *" "$origin/" "$destination" | |
cd "$destination" | |
for vcd in $(find -type d -a \( -name ".svn" -o -name ".git" \)); do | |
rm -rf "$vcd" | |
done | |
cd "$origin" | |
for f in $(find -name "*.h" -o -name "*.hpp" -o -name "*.hxx" -o -name "*.hh" -o -name "*.ixx" -o -name "*.ipp" -o -name "*.inc"); do | |
cp "$f" "$destination/$f" | |
done | |
cd "$destination" | |
find . -type d -empty -delete | |
cd "$orig_dir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment