Reading a filesystem without mounting?

Thanks, but I want to do it programmatically in a shell script. I need to know the contents of an ext2 filesystem image without acutally mounting it somewhere. Is that possible? Also, is there a way to check whether a given file is an ext2 image or a normal file?

As in before a pass an image name to the mount command, I should be sure that it is an image and not a normal text file or something.
 
Back
Top