Can SD card sort by modification date not creation date please?
 
Notifications
Clear all

Can SD card sort by modification date not creation date please?  

  RSS
Rob Meades
(@rob-meades)
Estimable Member
Can SD card sort by modification date not creation date please?

Hi there. I save my 3D object files such that I have the name of the thing and an incrementing number on the end for different versions. Slic3r re-uses that filename, after appending stuff, when writing gcode to SD card and so my SD card contains lots of similar looking file names and I simply sort them by date order in the printer to always get the most recently written. When switching between object versions it is possible that I will write to a gcode file that already exists, so the creation date will be old but the modification date new.

As far as I can tell the MK3 printer firmware (version 3.6.0) sorts SD card contents by file creation date rather than by file modification date. I spent all of yesterday repeatedly printing out the top file from SD card in date sort order after I had modified the image and wondering why my subtle changes to the position of a support were not working until I noticed that the sort order was not what I expected; I was printing my_wonderful_3d_object_6.gcode instead of the intended my_wonderful_3d_object_5.gcode because my_wonderful_3d_object_6.gcode was most recently created whereas my_wonderful_3d_object_5.gcode was the one I was actually modifying. The incrementing number on my file naming is off the right of the printer display so it's not obvious which is which unless I hang around to look.

I guess the Slic3r's behaviour is correct in not changing the creation date when it writes to an existing file but the modification date will have been updated so would it be possible for the printer firmware to sort the SD card contents by file modification date? I can't see a use case for anyone wanting the printer to sort files by file creation date instead.

Posted : 31/03/2019 1:18 pm
RH_Dreambox
(@rh_dreambox)
Prominent Member
Re: Can SD card sort by modification date not creation date please?

If you make a change and save it then the file gets a new date and time.
If your printer is configured to display the latest saved at the top of the list, it should be correct.
On my printer, the last saved file is always displayed at the top, regardless of whether it is new or just changed.

But if you just rename the file in windows explorer then the file does not get a new time stamp.

Bear MK3 with Bondtech extruder

Posted : 31/03/2019 2:05 pm
bobstro
(@bobstro)
Illustrious Member
Re: Can SD card sort by modification date not creation date please?

Not sure if this applies to your situation, but I but if using a Flashair card via wireless, my timestamps are all set the same.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 31/03/2019 4:20 pm
Rob Meades
(@rob-meades)
Estimable Member
Topic starter answered:
Re: Can SD card sort by modification date not creation date please?

OK, maybe it's something I'm doing wrong. See below for evidence of what I'm seeing.

In this sequence the file body_motor_open_second_section_4_26_0.15mm_ASA_MK3.gcode starts out with a modification timestamp of 12:01 today. I then slice it again in Slic3r and it gets a modification timestamp of 21:45 today (screenshots taken with the SD card in the Windows machine that is running Slic3r). I put the SD card into the printer and body_motor_open_second_section_4_26_0.15mm_ASA_MK3.gcode is not at the top of the list, body_roof_former_3_0.2mm_PC_MK3.gcode is. The last picture is just to show that my sort order is set to [time], though of course alphabetical sorting would put body_roof lower than body_motor anyway.

Posted : 31/03/2019 11:11 pm
RH_Dreambox
(@rh_dreambox)
Prominent Member
Re: Can SD card sort by modification date not creation date please?

Try to change sorting from Date to something else and then change back to Date again.
It may be that the sorting has hung up.

I have also noticed that sorting can be wrong if I put the SD card in before I turn the printer on.
Usually I put in the SD card when the printer is switched on, and then a sorting is performed directly when the card is inserted.

Bear MK3 with Bondtech extruder

Posted : 01/04/2019 2:47 pm
Rob Meades
(@rob-meades)
Estimable Member
Topic starter answered:
Re: Can SD card sort by modification date not creation date please?

OK, I've tried setting the sort order to name, (order changes to name), changing it back again (the older file body_former_... is still at the top), switching the printer on and off again with and without the SD card inserted, no difference. Are we sure it's not sorting by file creation date instead of file modified date, 'cos that's what it looks like:

Sorting by file creation date with SD card inserted into Windows machine (which is the order I see on the printer):

Sorting by file modification date with SD card inserted into Windows machine (which is the order I want to see on the printer):

Posted : 01/04/2019 6:24 pm
draeath
(@draeath)
Active Member
Re: Can SD card sort by modification date not creation date please?

This powershell magic might work? It's emulating the 'touch' command from Unix.

Alternatively you could throw on cygwin or mingw (or even git's bash shell) and try touch from there - but that's probably a bit heavy for what you need.

Posted : 01/04/2019 11:00 pm
bobstro
(@bobstro)
Illustrious Member
Re: Can SD card sort by modification date not creation date please?

If I get so many files on the card that I really don't want to wade through them using a knob, I organize them in subdirectories.

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Posted : 01/04/2019 11:27 pm
Rob Meades
(@rob-meades)
Estimable Member
Topic starter answered:
Re: Can SD card sort by modification date not creation date please?

Agreed that I can reduce the number of files or use touch or equivalent to fiddle with the creation time/date of files, it's just that a "time" option in the printer firmware which sorts by file creation date will catch people out, since most people would expect it to bring the most recently updated files to the top rather than the ones which happened to be created first. If the firmware really is sorting by creation date, as I suspect, and could sort by modification date instead, then I think we would all win.

Does anyone know if there is an issues list or feature request list or Github repo or similar for the printer firmware where I could make such a request?

Posted : 01/04/2019 11:31 pm
draeath
(@draeath)
Active Member
Re: Can SD card sort by modification date not creation date please?

Yep! The firmware repository is here.

Here's the code of interest, I think. Note that 'creation_date' and 'creation_time' are used liberally through that file, so it wouldn't be a quick 1 line change.

EDIT: though it would be ugly, you could probably tweak this assignment to grab modification time instead!

creationDate = p.creationDate;
creationTime = p.creationTime;

Posted : 02/04/2019 7:26 pm
Rob Meades
(@rob-meades)
Estimable Member
Topic starter answered:
Re: Can SD card sort by modification date not creation date please?

Many thanks, turns out it was reported on 10th March 2018. I have added my up-vote to it. 🙂

Posted : 02/04/2019 8:40 pm
draeath
(@draeath)
Active Member
Re: Can SD card sort by modification date not creation date please?

I've added my notes to the issue as well, hopefully someone with a printer and an adventurous spirit might try patching it up.

Looks like a relatively simple change, but it would be silly of me to put a patch in with no way to test it locally first.

Good luck!

Posted : 02/04/2019 8:54 pm
Rob Meades
(@rob-meades)
Estimable Member
Topic starter answered:
Re: Can SD card sort by modification date not creation date please?

Thanks, let's see what happens.

Posted : 02/04/2019 10:37 pm
draeath
(@draeath)
Active Member
Re: Can SD card sort by modification date not creation date please?

My printer shipped today.

If the issue hasn't been updated before I get comfortable with it, I'll have a go at fixing this myself. I suspect a tested patch PR would stand a better chance than just an issue report 😉

Posted : 05/04/2019 10:37 pm
Rob Meades
(@rob-meades)
Estimable Member
Topic starter answered:
Re: Can SD card sort by modification date not creation date please?

Excellent. 🙂

Posted : 06/04/2019 12:25 am
draeath
(@draeath)
Active Member
Re: Can SD card sort by modification date not creation date please?

Done and tested on my end. There's a pull request submitted. Check the github issue for details.

Posted : 16/04/2019 12:44 pm
jwvaughn
(@jwvaughn)
Estimable Member
Re: Can SD card sort by modification date not creation date please?

This issue has been a pet peeve of mine for some time. Thanks for taking action on it!!

Jerry

Posted : 16/04/2019 8:50 pm
Share: