Skip to content

Instantly share code, notes, and snippets.

@ccawley2011
Created July 30, 2020 12:03
Show Gist options
  • Save ccawley2011/ce734a948936c151f22a2f0440761d05 to your computer and use it in GitHub Desktop.
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
#!/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