I've got a folder containing various files: text files, image files, etc. All files are named using the DOS convention - i.e. their names are in all caps, and are 8 characters long or shorter.

Write a Python script that:

1. Takes a folder as an argument.
2. Concatenates all files in that folder into a single file named A.FSP.
3. Creates an index file named A.IDF containing the names of all the original files and their offsets in the resulting FSP file.

The structure of the enties in the IDF index file should be this:
1. Name of the file (always 8 bytes long, and if the name is shorter, pad the remaining bytes with spaces).
2. Extension of the file (always 3 bytes long).
3. Offset of the first byte of the file in the concatenated FSP file (always 4 bytes long, with the least significant byte being first, then the second-least significant byte, and so on).

There must be no padding bytes between entries. So the most significant byte of the offset is followed immediately by the name of the next file within the concatenated FSP file.

Example: suppose we have a folder with two files: 1.PNG (size = 20000 bytes) and 1.PNG (size=14 bytes). The resulting IDF file in this example should be this (in hex form): 31 20 20 20 20 20 20 20 50 4E 47 00 00 00 00 31 20 20 20 20 20 20 20 54 58 54 20 4E 00 00