Skip to content

Instantly share code, notes, and snippets.

@shiffman
Created November 17, 2014 21:24
Show Gist options
  • Select an option

  • Save shiffman/7b4c3b06f02101bbe050 to your computer and use it in GitHub Desktop.

Select an option

Save shiffman/7b4c3b06f02101bbe050 to your computer and use it in GitHub Desktop.
List without DS_Store
String[] listFileNames(String dir) {
File file = new File(dir);
if (file.isDirectory()) {
String names[] = file.list();
StringList filelist = new StringList();
for (String s : names) {
if (!s.contains("DS_Store")) {
filelist.append(s);
}
}
return filelist.array();
} else {
// If it's not a directory
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment