hallo zusammen,
ich will einen Ordner rekursiv kopieren...
hier unten ist mein Code! was mach ich falsch?
um es kurz zu sagen, es wird einfach gar nichts kopiert!!
danke im voraus
	
	
	
	
	
		
	
	
	
	
	
	
		
	
			
			ich will einen Ordner rekursiv kopieren...
hier unten ist mein Code! was mach ich falsch?
um es kurz zu sagen, es wird einfach gar nichts kopiert!!
danke im voraus
		Java:
	
	public class App {
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		// TODO Auto-generated method stub
		System.out.println("Dateien und ordner werden kopiert");
		Copy c = new Copy();
		c.copyDir("C:\\quelle", "C:\\ziel");
		
	
		
	}
}
	
		Java:
	
	import java.io.*;
public class Copy {
    
    private BufferedInputStream in = null;
    private BufferedOutputStream out = null;
    
    public void copyDir(File quelle, File ziel) throws FileNotFoundException, IOException {
        
        File[] files = quelle.listFiles();
        ziel.mkdirs();
        for (File file : files) {
            if (file.isDirectory()) {
                copyDir(file, new File(ziel.getAbsolutePath() + System.getProperty("file.separator") + file.getName()));
            }
            else {
                copyFile(file, new File(ziel.getAbsolutePath() + System.getProperty("file.separator") + file.getName()));
            }
        }
    }
    
    public void copyFile(File file, File ziel) throws FileNotFoundException, IOException {
        
//        System.out.println("Copy " + file.getAbsolutePath() + " to " + ziel.getAbsolutePath());
        in = new BufferedInputStream(new FileInputStream(file));
        out = new BufferedOutputStream(new FileOutputStream(ziel, true));
        int bytes = 0;
        while ((bytes = in.read()) != -1) {
            out.write(bytes);
        }
        in.close();
        out.close();
    }
	public void copyDir(String quelle, String ziel) 
	{
		// TODO Auto-generated method stub
		
	}
	
	
}