Appropriately use functions from FileUtils instead of shell.