how to create folder wen the condition satisfied

hi

i hav files ha1j ha2m ha3n ha4q ha5s ...like tat im having some 20 files ..and i want to create a folder as the same amount of files which im having wen the condition if loop is satisfied ..

thank you

what is the if condition and the folders name?

can you explain your question in more details ?????

hi

my program is to sort the files and my files will be like tis

engPG1j1.top
engPG2h3.top
engPG3g5.top
engPG4r6.top
engPG5y1.top
engPG1u3.top
engPG2w8.top
engPG3e5.top
engPG4m3.top
etc...

And i have to create N folders at run time as many PG1 Files
say suppose im having 5 PG1 files ,then i have to create 5 folders and
each PG1 files should go into each folder again each PG2 files have to do the same
finally it will be (PG1,PG2,PG3,PG4,PG5)in one folder like tat i have to do

Thank you

i am assuming u hv some files like 20 after 20 files reading u want to create a folder ryt.

#!bin/ksh
count=` find $HOME /- maxdepth 1 - name "test_dat*.txt" - print | wc -l
if [ $count -gt 0 ]

then
for $txtfl in $HOME/test_dat*.txt;
do
echo "copy ur files in $txtfl"

cat $txtfl >> $HOME/dnew/dfile.dat
done;
print "moved sucessfully"
fi

i hope this will work ..
creates a new folder and file

thank you for ur great idea
its working man thank u a lot :wink: