Skip to content

Instantly share code, notes, and snippets.

@shinnn
Last active December 10, 2015 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinnn/4364027 to your computer and use it in GitHub Desktop.
Save shinnn/4364027 to your computer and use it in GitHub Desktop.
Delete all empty log files, for Processing
/*
* 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