Generally it's best not to shell out of the programming language unless you have to. I'd use FileUtils for this, same recipe as above: http://stackoverflow.com/a/12617369/2883120