No G-code command to return files like GET /rr_filelist ?
-
I'm making a desktop app to control the Duet 2 WiFi for CNC use (WorkBee). I do all communication over telnet, except for listing files on the SD card for which I use HTTP. The reason is that
GET /rr_filelist
returns the information in a convenient format. I know there isM20 S2
, but that is not as convenient, since it doesn't return files size or creation time, so I would have to make an additional call withM36
to get the details (all I care about is file size and date). On top of that, I can't find a way to get directory create time with any G-code, asM36
on a directory gives an error.My questions are:
- Is there a way to get the same information as
GET /rr_filelist
over telnet/G-code, in case I have missed it? - If not, any plans to add it?
- Is there any way to get directory create time over telnet/G-code?
(Using a desktop app makes my workflow much easier, since no mouse clicking is needed, and I generally find usability to be better. This makes more of a difference for CNC use -- as opposed to 3D printing -- as you manually move the router around a lot more than with 3D printing, probing corners etc. My app is already usable, but still work in progress.)
- Is there a way to get the same information as
-
@otso You can use M20 to get a list of files.
https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m20-list-sd-card
-
@sindarius Did you read my post?
"I know there is M20 S2, but that is not as convenient, since it doesn't return files size or creation time"
How do I get the creation time of a directory?
-
@otso try M20 S3.
-
@dc42 Wow, thanks! Exactly what I was looking for! Maybe add that to the manual.
I just finished implementing using
M20 S2
andM36
, but it should be easy enough to go "back" usingM20 S3
.Here's using
M20 S2
,M36
, no directory date: -
@dc42 It's no problem whatsoever, but I find it a little odd that both
M20 S2
andS3
include the "Begin file list" and "End file list".Begin file list {"dir":"0:/gcodes/","first":0,"files":[{"type":"d","name":"Test","size":0,"date":"2022-03-14T00:48:18"},{"type":"f","name":"clock_contour.nc","size":5704,"date":"2022-03-10T19:47:08"}],"next":0} End file list
I would expect a pure JSON response, like
M36
and other commands that return JSON do. I can understand the header and footer for the textS0
response. -
@otso yes that extra text is unintentional. I will log it for fixing in RRF 3.5.
-
@otso I think that text may go away if you use M555 to change the emulation mode from Marlin to RRF.
-
-
-
@otso this is now fixed in the source code. The fix will be in RRF 3.5.0beta1 and in 3.4.1beta1.