Help with Java Program

Status
Not open for further replies.

JesusII

Ars Scholae Palatinae
722
I'm writing a small java program to help me organize and backup my mp3 collection, but I've run into a couple of stumbling blocks.

1. Is there anyway to find out the last time a file was accessed? I noticed win2K seems to store that info but I couldn't find anything under the Java API.

2. I want to create files that can be read by CD-Buring software; like .CUE sheets. I was planning on using CUE sheets but they don't seem to support creating directories.

Any help would be appreciated. Thank you.
 

wb

Ars Legatus Legionis
25,208
Subscriptor
1. Is there anyway to find out the last time a file was accessed? I noticed win2K seems to store that info but I couldn't find anything under the Java API.

I don't think you can do this in Java without using a native method. The closest you can get is File.lastModified() unless something has been added in a recent version that I am unaware of.

2. I want to create files that can be read by CD-Buring software; like .CUE sheets. I was planning on using CUE sheets but they don't seem to support creating directories.

You can create an image in the Joliet (an extension to ISO9660) format, which is (I believe) the format CD burning software is looking for.

Joliet Specification
 

ssmith

Ars Scholae Palatinae
928
To avoid using a native method, it may be simpler to use Runtime.exec( ) to do a DIR /t:a <dir_name>, then catch and parse the output.
It will probably look a bit like this:

code:<HR>
Code:
String dir = "c:/";<P>Process process = Runtime.exec( "dir /t:a " + dir );
BufferedReader reader = new BufferedReader( new InputStreamReader( process.getInputStream( ) ) );
process.waitFor( );<P>String lineIn = null;
while( null != ( lineIn = reader.readLine( ) ) )
{
    // parse the strings coming in
}<P>

I haven't compiled and run this, but it's there abouts. Certainly quite easily doable. Hope it helped.

edit: wrong way round :eek:

[This message was edited by ssmith on January 09, 2002 at 18:14.]
 
Status
Not open for further replies.