Created
October 24, 2011 07:24
-
-
Save mzaks/1308533 to your computer and use it in GitHub Desktop.
Small program to make files writable recursivly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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