package be.jedi.dir2floppy; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import de.waldheinz.fs.FileSystem; import de.waldheinz.fs.FsDirectoryEntry; import de.waldheinz.fs.FsFile; import de.waldheinz.fs.fat.SuperFloppyFormatter; import de.waldheinz.fs.util.FileDisk; /** * Hello world! * */ public class Dir2Floppy { public static void main( String[] args ) { if (args.length < 2) { System.out.println("Usage: java -jar dir2floppy.jar "); System.exit(-1); } FileDisk device = null; //Create the floppy try { device = FileDisk.create(new File(args[1]),(long)1440 * 1024); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(-1); } //Format the floppy FileSystem fs=null; try { fs = SuperFloppyFormatter.get(device).format(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(-1); } //Iterate of directories File dir = new File(args[0]); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory System.out.println("Error. does the directory exist?"); System.exit(-1); } else { for (int i=0; i