thinkyhead

M20 - List SD Card

sdcard List the contents of the SD Card. SDSUPPORT

Description

List all printable files on the SD card back to the requesting serial port in compact DOS 8.3 format. Only files with .gcode, .gco, and .g extensions will be listed. Hidden files (beginning with .) will not be listed.

Hosts or serial controllers should send M20 to get a DOS 8.3 file listing of the active media device that includes file sizes.

The file size is included in the output since Marlin 1.1.0.

Notes

Requires SDSUPPORT

Usage

M20 [L]

Parameters

[L] 2.0.9LONG_FILENAME_HOST_SUPPORT

Include the long filename in the listing.

Examples

List the contents of the SD card

> M20
Begin file list
myfile.gco 14129
subdir/moreth\~1.gco 68447
End file list
ok

The firmware will send no other output between “Begin file list” and “End file list.”

List files with long filename (for display)

> M20 L
Begin file list
myfile.gco 14129 MyFile.gcode
sub_di\~1/moreth\~1.gco 68447 Sub\ Directory/MoretHall.gcode
End file list
ok

This format produces a prettier File Manager in OctoPrint, but the long name is not used in selecting the file to print, nor are folder long names included.