Page 1 of 1

unix script needs to be implemented in DOs Batch script

Posted: 04 Oct 2009 07:02
by vijays3
Hi all,

I have a unix script which needs to be implemented in DOS script
here is the unix script..
#---------script starts
nofiles=`ls | grep ^a`

#This line gets the all file and dir which start wih 'a'

for i in $nofiles
do
if [ -d $i ] # This line checks for dir
then
rm $i
fi
done
#---------script ends

my requiremet is to have to delete all ej* directories from a folder in one go..

Thnaks

Posted: 05 Oct 2009 14:51
by avery_larry
for /d %%a in (ej*) do del /q /s "%%~a"