File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Read short DOS filename Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Read short DOS filename" Watch "Read short DOS filename" New topic

Read short DOS filename

Dirk Schumacher

Joined: Sep 06, 2006
Posts: 8

my dad wants to list the MSDOS short file names:
i.e. afilename.txt = afilenam~.txt

I know that the does not implement a method for returning such a short name.
Is there any MSDOS-FILE-API able to do that. Is there any algoriothm to compute the short filename from the long one?

I'm thankful for any suggestions.
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

Java is intended to be cross-platform, so where a particular platform takes a big diversion from what is shared, it tends to pass on implementing that functionality. There may be something in the Windows API you could use. Maybe use Runtime.exec() to invoke "dir" and get what you want.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Read short DOS filename
It's not a secret anymore!