import java.io.IOException;
import java.io.FileWriter;
import java.net.URL;
import java.util.Scanner;

public class converter
{
    public static final String DIRECTOR = "Director:";
    public static final String STARRING = "Starring:";
    public static final String RATING = "Rating:";
    public static final String MEDIA = "Media:";
    public static final String LANGUAGES = "Languages:";

    public static final String OUTPUT_FILE = "library.csv";

    public static void main (String args[]) throws IOException
    {
	String fileName = "FF74D200-9E9B-4A7C-8A58-70CEAA7FF488.html";

	URL url = new URL("file://"+System.getProperty("user.dir")+"/"+fileName);
	Scanner sc = new Scanner(url.openStream());
	StringBuffer sb = new StringBuffer();

	while (sc.hasNext())
	{
	    sb.append(sc.next());
	}

	String result = sb.toString();

	// Removing the HTML tags

	result = result.replaceAll("<[^>]*>", "");
	//	System.out.println("Contents of the web page: "+result);

	int directorStart = result.indexOf(converter.DIRECTOR);
	String movie = result.substring(0, directorStart);

	int starsStart = result.indexOf(converter.STARRING);
	String director = result.substring(directorStart+converter.DIRECTOR.length(), starsStart);

	int mediaStart = result.indexOf(converter.MEDIA);
	int languagesStart = result.indexOf(converter.LANGUAGES);
	String media = result.substring(mediaStart+converter.MEDIA.length(), languagesStart);

	System.out.println("Movie: "+movie);
	System.out.println("Director: "+director);
	System.out.println("Media: "+media);

	FileWriter csvWriter = new FileWriter(OUTPUT_FILE);

	csvWriter.append(movie);
	csvWriter.append(",");
	csvWriter.append(director);
	csvWriter.append(",");
	csvWriter.append(media);
	csvWriter.append("\n");

	csvWriter.flush();
	csvWriter.close();
    }

    private static void addFileData (FileWriter csvWriter)
    {
	String fileName = "FF74D200-9E9B-4A7C-8A58-70CEAA7FF488.html";

	URL url = new URL("file://"+System.getProperty("user.dir")+"/"+fileName);
	Scanner sc = new Scanner(url.openStream());
	StringBuffer sb = new StringBuffer();

	while (sc.hasNext())
	{
	    sb.append(sc.next());
	}

	String result = sb.toString();

	// Removing the HTML tags

	result = result.replaceAll("<[^>]*>", "");
	//	System.out.println("Contents of the web page: "+result);

	int directorStart = result.indexOf(converter.DIRECTOR);
	String movie = result.substring(0, directorStart);

	int starsStart = result.indexOf(converter.STARRING);
	String director = result.substring(directorStart+converter.DIRECTOR.length(), starsStart);

	int mediaStart = result.indexOf(converter.MEDIA);
	int languagesStart = result.indexOf(converter.LANGUAGES);
	String media = result.substring(mediaStart+converter.MEDIA.length(), languagesStart);

	/*
	System.out.println("Movie: "+movie);
	System.out.println("Director: "+director);
	System.out.println("Media: "+media);
	*/

	csvWriter.append(movie);
	csvWriter.append(",");
	csvWriter.append(director);
	csvWriter.append(",");
	csvWriter.append(media);
	csvWriter.append("\n");
    }

}
@@ -48,16 +48,37 @@
 Writer;%0A
+import java.io.File;%0A
 import j
@@ -552,397 +552,180 @@
 ing 
-fileName = %22FF74D200-9E9B-4A7C-8A58-70CEAA7FF488.html%22;%0A%0A%09URL url = new URL(%22file://%22+System.getProperty(%22user.dir%22)+%22/%22+fileName);%0A%09Scanner sc = new Scanner(url.openStream());%0A%09StringBuffer sb = new StringBuffer();%0A%0A%09while (sc.hasNext(
+path = %22.%22;%0A%0A%09for (int i = 0; i %3C args.length; i++)%0A%09%7B%0A%09    if (%22-help%22.equals(args%5Bi%5D
 ))%0A
-%09%7B%0A
 %09    
-sb.append(sc.next());%0A%09%7D%0A%0A%09String result = sb.toString();%0A%0A%09// Removing the HTML tags%0A%0A%09result = result.replaceAll(%22%3C%5B%5E%3E%5D*%3E%22, %22
+%7B%0A%09%09System.out.println(%22converter %5B-path %3Crelative path%3E%5D %5B-help%5D
 %22);%0A%09
-//
 %09System.
 out.
@@ -724,842 +724,363 @@
 tem.
-out.println(%22Contents of the web page: %22+result);%0A%0A%09int directorStart = result.indexOf(converter.DIRECTOR);%0A%09String movie = result.substring(0, directorStart);%0A%0A%09int starsStart = result.indexOf(converter.STARRING);%0A%09String director = result.substring(directorStart+converter.DIRECTOR.length(), starsStart);%0A%0A%09int mediaStart = result.indexOf(converter.MEDIA);%0A%09int languagesStart = result.indexOf(converter.LANGUAGES);%0A%09String media = result.substring(mediaStart+converter.MEDIA.length(), languagesStart);%0A%0A%09System.out.println(%22Movie: %22+movie);%0A%09System.out.println(%22Director: %22+director);%0A%09System.out.println(%22Media: %22+media);%0A%0A%09FileWriter csvWriter = new FileWriter(OUTPUT_FILE);%0A%0A%09csvWriter.append(movie);%0A%09csvWriter.append(%22,%22);%0A%09csvWriter.append(director);%0A%09csvWriter.append(%22,%22);%0A%09csvWriter.append(media);%0A%09csvWriter.append(%22%5Cn%22);
+exit(0);%0A%09    %7D%0A%0A%09    if (%22-path%22.equals(args%5Bi%5D))%0A%09%09path = args%5Bi+1%5D;%0A%09%7D%0A%0A%09FileWriter csvWriter = new FileWriter(OUTPUT_FILE);%0A%0A%09File folder = new File(System.getProperty(%22user.dir%22)+%22/%22+path);%0A%09File%5B%5D fileNames = folder.listFiles();%0A%0A%09for (File file : fileNames)%0A%09%7B%0A%09    URL url = new URL(%22file://%22+file.getPath());%0A%0A%09    addFileData(url, csvWriter);%0A%09%7D
 %0A%0A%09c
@@ -1161,16 +1161,25 @@
 leData (
+URL url, 
 FileWrit
@@ -1195,154 +1195,33 @@
 ter)
-%0A    %7B%0A%09String fileName = %22FF74D200-9E9B-4A7C-8A58-70CEAA7FF488.html%22;%0A%0A%09URL url = new URL(%22file://%22+System.getProperty(%22user.dir%22)+%22/%22+fileName);
+ throws IOException%0A    %7B
 %0A%09Sc

Update converter.java