EightDotThree

8DOT3 file name helper class & functions.

class pyfatfs.EightDotThree.EightDotThree(encoding: str = 'ibm437')

Bases: object

8DOT3 filename representation.

Offer 8DOT3 filename operation.

Parameters:

encoding – Codepage for the 8.3 filename. Defaults to FAT_OEM_ENCODING as per FAT spec.

INVALID_CHARACTERS = [range(0, 32), 34, 42, 43, 44, 46, 47, 58, 59, 60, 61, 62, 63, 91, 92, 93, 124]

Invalid characters for 8.3 file names

SFN_LENGTH = 11

Length of the byte representation in a directory entry header

checksum(**kwargs)
get_unpadded_filename(**kwargs)
static is_8dot3_conform(entry_name: str, encoding: str = 'ibm437')

Indicate conformance of given entries name to 8.3 standard.

Parameters:
  • entry_name – Name of entry to check

  • encodingstr: Encoding for SFN

Returns:

bool indicating conformance of name to 8.3 standard

static make_8dot3_name(dir_name: str, parent_dir_entry) str

Generate filename based on 8.3 rules out of a long file name.

In 8.3 notation we try to use the first 6 characters and fill the rest with a tilde, followed by a number (starting at 1). If that entry is already given, we increment this number and try again until all possibilities are exhausted (i.e. A~999999.TXT).

Parameters:
  • dir_name – Long name of directory entry.

  • parent_dir_entryFATDirectoryEntry: Dir entry of parent dir.

Returns:

str: 8DOT3 compliant filename.

Raises:

PyFATException: If parent dir is not a directory or all name generation possibilities are exhausted

set_byte_name(name: bytes)

Set the name as byte input from a directory entry header.

Parameters:

namebytes: Padded (must be 11 bytes) 8dot3 name

set_str_name(name: str)

Set the name as string from user input (i.e. folder creation).