function to parse directory debugged