Im hoping someone may be able to give me a hand with a little script that will list all files in a dircetory. I have one so far that works with eggdrop to add and remove a dir, but id like my egg to also list whats there (for ftp requests, etc) here's what i have so far for adding/deleting:
the .sh file:
REQDIR="/glftpd/site/Requests"
SITENAME="IcD"
if [ "$1" = "" ]; then
echo "Use it correctly"
exit 0
else
if [ "$1" = "add" ]; then
if [ "$2" = "" ]; then
echo "Specify a request... Usage: !req <release>"
exit 0
else
ALREADYTHERE="$( ls $REQDIR | grep $2 )"
if [ "$ALREADYTHERE" = "" ]; then
mkdir $REQDIR/$2-$3
echo "-$SITENAME- [REQ] + New Request: $2 by $3"
else
echo "Request already exsists, you sure you got it right?"
exit 0
fi
fi
else
if [ "$1" = "del" ]; then
if [ "$2" = "" ]; then
echo "Specify a request to delete... Usage: !delreq <release>"
exit 0
else
ALREADYTHERE="$( ls $REQDIR | grep $2 )"
if [ "$ALREADYTHERE" != "" ]; then
rm -fr $REQDIR/$ALREADYTHERE
echo "-$SITENAME- [REQ] - Deleted Request: $ALREADYTHERE"
else
echo "No request named like that, try to rephrase"
exit 0
fi
fi
fi
fi
fi
exit 0
and the .tcl file :
bind pub - !req pub:req
bind pub - !delreq pub:delreq
proc pub:req {nick uhost handle chan arg} {
set binary {/glftpd/bin/request.sh}
set what [lindex $arg 0]
set output [exec $binary add $what $nick]
puthelp "PRIVMSG $chan :$output"
}
proc pub:delreq {nick uhost handle chan arg} {
set binary {/glftpd/bin/request.sh}
set what [lindex $arg 0]
set output [exec $binary del $what]
puthelp "PRIVMSG $chan :$output"
}
putlog "request.tcl loaded"
if anyone may be able to help me with the dir listing part, id be forever grateful )