Skip to content

Instantly share code, notes, and snippets.

@ralphsaunders
Created January 19, 2016 12:32
Show Gist options
  • Save ralphsaunders/66787ea24b0860b6ccbe to your computer and use it in GitHub Desktop.
Save ralphsaunders/66787ea24b0860b6ccbe to your computer and use it in GitHub Desktop.
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Hagrid {
final static List<String> compass = new ArrayList<>(Arrays.asList("N","E","S","W"));
public static void main(String[] args) {
File root = new File("C:/Users/.../Desktop/Hedge Maze");
gogogo(root,100);
}
public static void gogogo(File root, int depth) {
if (depth == 0) return;
for (String s : compass) {
File subdir = new File(root,s);
subdir.mkdirs();
gogogo(subdir,depth-1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment