Index: scripts/factory_reset.sh =================================================================== diff -u -rf822c3490ef34c2c800020543bcb6afcb959de4a -r041be01bb59cfe463cc6fd834f296b7545e4ac64 --- scripts/factory_reset.sh (.../factory_reset.sh) (revision f822c3490ef34c2c800020543bcb6afcb959de4a) +++ scripts/factory_reset.sh (.../factory_reset.sh) (revision 041be01bb59cfe463cc6fd834f296b7545e4ac64) @@ -176,9 +176,19 @@ } function deleteLogFiles() { - # TODO this will always fail due to the fact that - # UI is not pausing on it's writing of log when we attempt a removal, causing the count to always be > 0 - clearFolderContent $LOC_LOG_BASE_FOLDER "logs" + # handling log deletion in a special manner: + # - Log files generated today + # - are not deleted + # - not part of the checking whether deletion was successful + # - setting maxDepth to 2 due to path used is root level with sd-card/ folders of logs + find "$LOC_LOG_BASE_FOLDER" -maxdepth 2 -type f -daystart -mtime +0 -exec rm -f {} + + + _has_error_=$? + exitError $_has_error_ $ERR_REMOVE_CMD_FIL "Log file deletion" + + fileCount=$(find "$LOC_LOG_BASE_FOLDER" -maxdepth 2 -type f -daystart -mtime +0 | wc -l) + _has_error_=$fileCount + exitError $_has_error_ $ERR_REMOVE_DEL_FIL "Remained '$fileCount' file undeleted" } # delete WiFi settings