Return to Snippet

Revision: 34882
at October 29, 2010 17:55 by bluestan


Updated Code
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;

public class GETFILE{
public static void main(String[] vargs){
    File aFile = new File(vargs[0]);
    File[] files = aFile.listFiles(); 
    ArrayList<File> fileList =  new ArrayList<File>();          
    scan(aFile, fileList);
    
    for(File f: fileList) {
        System.out.println(f.toString());
        f.renameTo(new File("plugin.zip"));
    }
							
    }//end main
	
    private static void scan(File file, ArrayList<File> all){
	File[] files = file.listFiles(); 
	if (files != null) {
	    for (File child : files) {
		if(child.isDirectory()){
		    scan(child, all);
		}else{
		    all.add(child);
		}
	    }
	}
    }

}

Revision: 34881
at October 29, 2010 15:45 by bluestan


Initial Code
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;

public class GETFILE{
public static void main(String[] vargs){
				File aFile = new File(vargs[0]);
				
				File[] files = aFile.listFiles(); 
                ArrayList<File> fileList =  new ArrayList<File>(); 
               
				scan(aFile, fileList);

                for(File f: fileList) {
                    System.out.println(f.toString());
					f.renameTo(new File("plugin.zip"));
                }
				
				
				
    }//end main
	
	private static void scan(File file, ArrayList<File> all){
					File[] files = file.listFiles(); 
					if (files != null) {
						for (File child : files) {
							if(child.isDirectory()){
								scan(child, all);
							}else{
								all.add(child);
							}
						}
					}
				}

}

Initial URL

                                

Initial Description

                                

Initial Title
scan directory and rename

Initial Tags
file

Initial Language
Java