Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filename Converter

 
Greg Roberts
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a program that will read in a directory, check the filenames of every file, organize the files into their own directories with the correct filename format.

I have a list of files in the format:
<firstName> <lastName> - <studentNumber> - <correctName>(<aNumber> ; ) .java
as in:
Derrick Cawthon - 900046067 - UndergraduateStudent( 15 ).java

And they need to come out as a folder named CawthonDerrick and the file within UndergraduateStudent.java.

I have a directory pulled from a file chooser and the files in the directory placed in an ArrayList.

How would I go about checking every file for format errors and make the changes? I was planning on populating a new ArrayList with the files in their correct format. From there I would create a directory with the persons LastName/FirstName and drop the appropriate files into the new directory. I just don't know how to go about implementing this.

Would the Formatter class help any?

[ November 15, 2005: Message edited by: Greg Roberts ]
[ November 15, 2005: Message edited by: Greg Roberts ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic