in reply to determining folder or files type

I believe Win32::File can do this for you
-Robert