#!/bin/bash
if [ ! -f MSDN1_dirs.dir ] ;then
  echo -e "\n*** Re-generating DIR output"
  cmd /c dir /ad /s /b p: >MSDN1_dirs.dir
  d2u MSDN1_dirs.dir
  sort MSDN1_dirs.dir >MSDN1_dirs.sdir

  echo -e "\n*** Re-generating cygcheck output"
  cygcheck -svr >c_svr-snap.txt

fi

echo -e "\n*** CYGWIN1 status from cygcheck output"
grep -i cygwin1 c_svr-snap.txt

echo -e "\n*** Re-generating find output"
find /cygdrive/p -type d >MSDN1_dirs

echo -e "\n*** convert find output to MS-style paths"
cat MSDN1_dirs | ( read line; while [ ! -z "$line" ]; \
 do cygpath -w "$line"; read line; done) >MSDN1_dirs-w
sort MSDN1_dirs-w >MSDN1_dirs-sw 

echo -e "\n*** Re-generating diff output"
diff -iup MSDN1_dirs-sw MSDN1_dirs.sdir >MSDN1_dirs.diff
head -20 MSDN1_dirs.diff
echo -e "\n<*** SNIP ***>\n"
tail MSDN1_dirs.diff

echo -e "\n*** Count lines"
wc -l MSDN1_dirs.sdir MSDN1_dirs-sw

