Long folder and file names
mbex exports the activities and files in a folder structure that resembles the organisation of the course on Moodle.
The issue with this approach is that all major operating systems (Windows, macOS, Linux) have a limitation on the length of path and file names. On Windows, there is a way to bypass this limitation but there is no guarantee that the extracted file will be readable. It depends on the installed version and updates of Windows.
As Moodle is used by millions of people around the world following different conventions and preferences for naming resources, it is impossible to impose limitations or predict the length of the exported path. Therefore, when mbex attempts to replicate the structure of a course in folders and files, there are cases where it reaches the limitations of the operating system and generates an error.
In order to mitigate this situation, v.1.4.0 introduces an additional option to name exported folders and files that uses generic names for folders and files (Section, Resource). The option can be found in the âExport Optionsâ tab on the main screen.
As an example, letâs assume a course is called âAn introduction to the complexity of long folder and file names on Windowsâ. This course has a session called âHistorical and cultural reasons that led to the limitations people in the 21st century are facing with long folder and file namesâ. In this session, letâs assume there is a PDF file called âBill Gates on what made him choose hard limits for long file and folder names on Windows 3.10 and why Jobs and Linus followed suit: a necessity or a preference?.pdfâ.
Letâs also assume the exported file will be saved in âC:\Windows\Users\Desktop\mbexâ.
Typically, mbex will attempt to create the PDF file at this location:
- c:\Windows\Users\Desktop\mbex\An introduction to the complexity of long folder and file names on Windows\Historical and cultural reasons that led to the limitations people in the 21st century are facing with long folder and file names\Bill Gates on what made him choose hard limits for long file and folder names on Windows 3.10 and why Jobs and Linus followed suit: a necessity or a preference?.pdf
âŠand, typically again đ„ , it will fail because the full path is 399 characters long; this is above the 255 character limit on Windows.
When mbex uses generic names, the exported file will be saved in
- c:\Windows\Users\Desktop\mbex\An introduction to the complexity of long folder and file names on Windows\001 â Section\001 â Resource.pdf
âŠwhich counts 137 characters. mbex will increase the two numbers according to the number of extracted sections and resources. Additionally, a file will be created with the mapping of the generic names to the original ones.
In summary, there are three ways to deal with long names:
- Extract the content with the default settings: If all works well, then great  đ . If you see errors and warnings in the extraction form, check the log to identify which resources have not be extracted. You may be able to download them directly from Moodle if they are not that many
- Change the output folder:Â Change the output folder to a shorter path (e.g., c:\exports) and try again
- Extract the content using generic names