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

Read short DOS filename

 
Dirk Schumacher
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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

I know that the java.io.File 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.
Greets
Dirk
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic