반응형
private fun removeAllSummaryLogFile() {
val file = File(filesDir.path + SUMMARY_FILE_PATH)
val fileList = file.listFiles()
if (file.exists()) {
if (fileList != null) {
for (i in fileList.indices) {
if (fileList[i].exists()) {
fileList[i].delete()
}
}
}
}
}
listFiles()로 하위 목록을 가져온 뒤 하나씩 지워준다.
반응형
'Android' 카테고리의 다른 글
Android DEBUG 모드 체크하기 / 디버그 모드일때만 로그 보이기 (0) | 2022.10.25 |
---|---|
Android Release 모드에서 Log 보기 (0) | 2022.10.12 |
Kotlin for문 (0) | 2022.08.18 |
Foreground Service 사용해보기 (0) | 2022.08.10 |
Fatal Exception: android.content.ActivityNotFoundException 예외처리 (0) | 2022.06.28 |
댓글