Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : MMB CHECKING FOR A DIRECTORY
Author | Message | ||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
What is the neatest and efficient way of checking that a directory exists on the SDCARD and creating it if it doesn't ? I would like to save data to eg \2024\LOGFILES\ & \2024\EVTFILES\ 0A47 |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
There may be a typo in the top one. The way it actually works makes more sense. > ? MM.INFO(EXISTS dir "Temp") 1 > ? MM.INFO(EXISTS file "Temp") 0> Edited 2024-09-25 13:13 by phil99 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6097 |
If the version of MMBasic you are using doesn't have MM.INFO(EXISTS ' f$ = DIR$("2024/logfiles", DIR) IF f$ = "" THEN PRINT "does not exist" ENDIF Jim VK7JH MMedit MMBasic Help |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thanks Phil, my question was a bit vague as I am looking at an older Armmite F4 and the reference in the handbook is: MM.ERRNO Is set to the error number if a statement involving the SD card fails or zero if the operation succeeds. This is dependent on the setting of OPTION ERROR. The possible values for MM.ERRNO are: 0 = No error 1 = No SD card found 2 = SD card is write protected 3 = Not enough space 6 = Cannot find file 7 = Cannot find file or directory 8 = Cannot create directory 12 = Hardware error 13 = File system error 14 = Directory not empty 16 = Syntax or general programming error 0A47 |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
You could update to F4 5.07.02. It has a lot of the latest features added. https://www.thebackshed.com/forum/ViewTopic.php?TID=16169&P=6#211904 |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Unfortunately, the target F4 is in a remote location and I can only access it via the console and there is no way to change the jumpers to re-flash it. 0A47 |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
I should add the reason for the directory need is that the F4 had refused to read/write to the 16GB SD card. I travelled there a few days ago and replaced a 32Gb SD Card. I can read the 16Gb SD in the PC it shows around 350MB used but 2665 files in the root directory and I think it has reached some sort of limit and I might be able to make it last longer by using dated directories. 0A47 |
||||
Print this page |