#!/usr/bin/env bash
[[ -s /home/tke/.bashrc ]] && source /home/tke/.bashrc
[[ -f ~/.config/z.sh ]] && . ~/.config/z.sh
logfile="/tmp/zupdate.log"

echo $$ >> "${logfile}"
env >> "${logfile}"
id >> "${logfile}"
type z >> "${logfile}"
cd 
echo $(pwd) >> "${logfile}"
while true ;
do
    newfolder=$(inotifywait -e create  /media/data/cases/ | awk '{print $1 $3}')
    echo "$$ Detected ${newfolder}" >> "${logfile}"
    z --add "${newfolder}"
done

