in reply to to Extract file type from a folder

The problem's obviously on line 23 of the ample code sample you've helpfully provided showing what you've already written.

(See How (Not) To Ask A Question.)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.