This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Filename Converter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Filename Converter" Watch "Filename Converter" New topic

Filename Converter

Greg Roberts
Ranch Hand

Joined: Feb 05, 2005
Posts: 72
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

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 ]

Greg Roberts<br />CIS Student<br />University of West Florida
I agree. Here's the link:
subject: Filename Converter
It's not a secret anymore!