File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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