I have a Java program that reads a singe text file, modifies it, and then saves it back into the same directory by appending "_Modified.txt" to the original filename. Code is attached below.
I want to modify this code so that instead of entering just a single filename, I instead enter a directory name. The Java program will then look into this directory and modify every file that it finds there. The files will all have the same type of text content and format, but the number of text files found in this directory can vary each time I run the program, and the filenames can be drastically different (not following any naming convention, other than ending with ".txt"). Every file in this directory will need to be modified each time the program is run.
Can someone please tell me how to modify this Java program so that is will look into a single directory, and modify every file that it finds there? As each text file is modified, I want to resave it (as before) by appending "_Modified.txt" to the original filename.
This was my very first post, so please excuse my user unfriendly format. I don't know (yet) how to use code tags to make it more readable.
Also, I'm fairly new to programming.
I will research how to use the Java commands that you suggest. If you have any links to sample code or if you are willing to modify my code as an example to show me, it would be greatly appreciated.