Skip to content

Instantly share code, notes, and snippets.

@sbstp
Created September 8, 2012 21:53
Show Gist options
  • Save sbstp/3680069 to your computer and use it in GitHub Desktop.
Save sbstp/3680069 to your computer and use it in GitHub Desktop.
File films = new File("x:/films");
File dir;
for (File fic : films.listFiles()) {
if (fic.isFile()) {
dir = new File(films, fic.getName().substring(0, fic.getName().lastIndexOf(".")));
dir.mkdir();
fic.renameTo(new File(dir, fic.getName()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment