Skip to content

Instantly share code, notes, and snippets.

@mzaks
Created October 24, 2011 07:24
Show Gist options
  • Save mzaks/1308533 to your computer and use it in GitHub Desktop.
Save mzaks/1308533 to your computer and use it in GitHub Desktop.
Small program to make files writable recursivly
import java.io.File;
public class MakeFilesWritable {
/**
* @param args
*/
public static void main(String[] args) {
File root = new File("C:\\foo");
System.out.println(root);
File[] listFiles = root.listFiles();
makeWritable(listFiles);
}
private static void makeWritable(File[] listFiles) {
for (File file : listFiles) {
if(file.isFile()){
file.setWritable(true);
} else {
makeWritable(file.listFiles());
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment