mirror of
https://github.com/sparkfun/OpenLog.git
synced 2024-09-20 00:50:14 +00:00
Fixed rm issue #134. dlkeng is my new favorite person.
Fixed issue #135: When removing files and there is a directory, all wildcard files are now removed correctly. Thank you dlkeng! Your patch worked great!
This commit is contained in:
parent
20d5c5a2bc
commit
1888d3df36
@ -149,6 +149,8 @@
|
||||
|
||||
28,640 bytes (yay! saved a bunch by removing the text-based menu system)
|
||||
|
||||
Added support for newlines when using the 'write' command.
|
||||
Should fix issue #149.
|
||||
*/
|
||||
|
||||
#include <SdFat.h> //We do not use the built-in SD.h file because it calls Serial.print
|
||||
@ -1252,15 +1254,17 @@ void command_shell(void)
|
||||
|
||||
strupr(command_arg);
|
||||
|
||||
currentDirectory.seekSet(0);
|
||||
while (tempFile.openNext(¤tDirectory, O_WRITE)) //Step through each object in the current directory
|
||||
{
|
||||
currentDirectory.rewind();
|
||||
while (tempFile.openNext(¤tDirectory, O_READ)) //Step through each object in the current directory {
|
||||
if (!tempFile.isDir() && !tempFile.isSubDir()) // Remove only files
|
||||
{
|
||||
if (tempFile.getFilename(fname)) // Get the filename of the object we're looking at
|
||||
{
|
||||
if (wildcmp(command_arg, fname)) // See if it matches the wildcard
|
||||
{
|
||||
tempFile.close();
|
||||
tempFile.open(¤tDirectory, fname, O_WRITE); // Re-open for WRITE to be deleted
|
||||
|
||||
if (tempFile.remove()) // Remove this file
|
||||
{
|
||||
++filesDeleted;
|
||||
|
Loading…
Reference in New Issue
Block a user