Hello, I am new to this codding stuff and I am only doing it for fun (personal little project) and for learing as I am not programer in any language apart from knowledge in shell scripting :(
Anyway after a few weeks looking at examples and searching the net and putting piaces together I have managed to create a class that will all files in a directory based on specific file extentions in(netBeans), this is a snip of the end of the code:
public static void main(String[] args) throws FileNotFoundException {
// USING java.io.File
File folder = new File("C:/temp");
// USING java.util.List
List<File> contents = ListFiles1.getFileListing(folder);
// PRINT OUT THE LIST OF FILES
for (File list : contents) {
if (list.isFile() && list.getName().toLowerCase().endsWith(".txt")
|| list.getName().toLowerCase().endsWith(".bmp")
|| list.getName().toLowerCase().endsWith(".doc")
)
System.out.println(list);
}
}
THIS IS THE RESULT WHEN I RUN THE FIRST CLASS
C:\>java -cp Details.jar packages.ListFiles
C:\temp\file_one.txt
C:\temp\dir6.5.6\BitmapImage.bmp
C:\temp\dir6.5.6\Something.txt
C:\temp\New Bitmap Image.bmp
C:\temp\New Text Document.txt
Now I want to create a second class that will use the output of the first class (ListFiles) and write it into a txt file, the problem is I can not get the second class to read the output of the first class.
I know that first I need change it so that instead of pronting the files to the console, it builds a List of the file and returns it.
Here is the problem, I can't figure it out :(
And then my second chalenge will be to see if my second class will work.
Any help woould be greatly appreciated. :)
Many Thanks in advance.