Thanks Graff. Now I have installed pkdb module after reading the point which you said in pervious reply and I can do the debugging line by line.
On this point :
"You might also need to consider what will happen when your program has to cover a different pattern of directory nesting."
Even i was thinking this, what ever i tried to script is now only for pre defined set of directory structure, which is very wrong way. Can you please advise how can make script more generic one so that don't need to depend on directory pattern