This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fds_file_delete delete all files with given id?

Hi

I'm trying to delete all files with a given file id. Will fds_file_delete() delete all files with a given file id, or just the first one it finds?

thanks

SDK14

Parents
  • According to the documentation...

    ret_code_t fds_file_delete	(	uint16_t 	file_id	)
    
    Function for deleting all records in a file.
    
    This function deletes a file, including all its records. Deleted records cannot be located using fds_record_find, fds_record_find_by_key, or fds_record_find_in_file. Additionally, they can no longer be opened using fds_record_open.
    
    Note that deleting records does not free the space they occupy in flash memory. To reclaim flash space used by deleted records, call fds_gc to run garbage collection.
    
    This function is asynchronous. Completion is reported through an event that is sent to the registered event handler function.
    
  • The documentation is ambiguous. You can have multiple files with the same file_id, and calling (for example) fds_record_find() can return any one of those files with the provided file_id. You have to loop through fds_record_find() and fds_record_open() to find/open every file with a given file_id, so it's plausible one would have to do the same thing with fds_file_delete().

Reply
  • The documentation is ambiguous. You can have multiple files with the same file_id, and calling (for example) fds_record_find() can return any one of those files with the provided file_id. You have to loop through fds_record_find() and fds_record_open() to find/open every file with a given file_id, so it's plausible one would have to do the same thing with fds_file_delete().

Children
No Data
Related