Created
July 30, 2020 12:03
-
-
Save ccawley2011/ce734a948936c151f22a2f0440761d05 to your computer and use it in GitHub Desktop.
Bash script to convert a source code tree for use on RISC OS
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 | |
ACTION="ln -sf" | |
if [ $# -lt 2 ]; then | |
echo "usage: $0 srcdir dstdir" | |
exit 1 | |
fi | |
SRCDIR=$1 | |
DSTDIR=$2 | |
EXTS="c h hdr o s" | |
for i in `find $SRCDIR -type f -printf '%P\n'`; do | |
mkdir -p $DSTDIR/$(dirname $i) | |
ext=${i##*.} | |
if [[ $EXTS == *"$ext"* ]]; then | |
mkdir -p $DSTDIR/$(dirname $i)/$ext | |
$ACTION $(realpath $SRCDIR/$i) $DSTDIR/$(dirname $i)/$ext/$(basename $i .$ext) | |
else | |
$ACTION $(realpath $SRCDIR/$i) $DSTDIR/$i | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment