Last active
December 10, 2015 01:58
-
-
Save shinnn/4364027 to your computer and use it in GitHub Desktop.
Delete all empty log files, for Processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Delete all empty log files, | |
* which are created when the "flush()" method isn't used correctly. | |
*/ | |
import java.io.File; | |
File[] files = new File(sketchPath("log")).listFiles(); | |
int deleted = 0; | |
for(File elm : files){ | |
if(elm.length() == 0){ | |
elm.delete(); | |
deleted++; | |
} | |
} | |
if(deleted > 0){ | |
println(deleted + " empty log file" + (deleted > 1 ? "s":"") + " deleted."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment