<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84352/littlefs-to-delete-the-file</link><description>Hi all, 
 i am using Littlefs in nrf_connect_sdk, 
 how can i flush the contents of file 
 Regards 
 Tushar</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Sep 2022 19:47:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84352/littlefs-to-delete-the-file" /><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/384436?ContentTypeID=1</link><pubDate>Fri, 02 Sep 2022 19:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1319beb9-ff89-4e7c-9fa1-df9e94fdbb91</guid><dc:creator>Oli</dc:creator><description>&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/372727?ContentTypeID=1</link><pubDate>Thu, 16 Jun 2022 08:02:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46938ed7-2b29-4f5e-8e45-25ace635c751</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Oli&lt;/p&gt;
&lt;p&gt;Yes, you can use the &lt;a href="https://docs.zephyrproject.org/2.7.0/reference/file_system/index.html#c.fs_unlink"&gt;fs_unlink(..)&lt;/a&gt; function to delete a file or directory.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/372621?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 14:38:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:daab04ef-b69b-438e-970c-ebcfc5277c9f</guid><dc:creator>Oli</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/ovrebekk"&gt;ovrebekk&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Is there a way to delete a file entirely?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;oli&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/351533?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 12:43:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6f2fe19-bca7-4ca8-9244-4dd418404600</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Tushar&lt;/p&gt;
&lt;p&gt;There is no function for clearing a file directly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Either you would have to use fs_write() to overwrite the existing data with 0&amp;#39;s, or you could possibly use the fs_truncate() function twice. One time to reduce the size of the file to 0, and a second time to increase the size back to the original size (but now filled with 0&amp;#39;s only).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As a side note, ignore my previous suggestion to use the lfs_file_sync() method, instead the fs_sync() method should be used for flushing the data buffers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/351327?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 12:33:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98a4066b-d58c-4b23-befa-eb56c8a4e64c</guid><dc:creator>Tushar_V</dc:creator><description>&lt;p&gt;Hi Torbjorn,&lt;/p&gt;
&lt;p&gt;i want to clear the contents of file&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Tushar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/351294?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 11:16:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cabab06c-238d-465e-9f60-90412627bf7f</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Tushar&lt;/p&gt;
&lt;p&gt;You mean you want to delete the file entirely, or you just want to clear all the content of the file?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/351224?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 05:28:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd079e75-9e94-4f1d-a71d-a95e694fe823</guid><dc:creator>Tushar_V</dc:creator><description>&lt;p&gt;Hi, Torbjorn,&lt;/p&gt;
&lt;p&gt;I&amp;#39;am running ../zephyr/samples/subsys/fs/littlefs example&lt;/p&gt;
&lt;p&gt;is there any way i can empty the file once after reading it&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Tushar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Littlefs to delete the file</title><link>https://devzone.nordicsemi.com/thread/351098?ContentTypeID=1</link><pubDate>Thu, 03 Feb 2022 12:44:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43742d9b-de63-4610-a015-b72a596d8c8b</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Tushar&lt;/p&gt;
&lt;p&gt;You can use the &lt;a href="https://github.com/littlefs-project/littlefs/blob/master/lfs.h#L551"&gt;lfs_file_sync(..)&lt;/a&gt; function for this.&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>