Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the directory list from linux system?

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am giving the path as This works fine under windows environment. But I want to change this according to linux system.
How to mention about the linux file path?

Is it something like below: B'cos under Linux, loops folder is under "/home/userrig/test/loops". Will it work? Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linux doesn't use "\" in paths; it uses "/" instead, which doesn't need to be doubled. I'm not sure why most people don't realize this, but in most contexts Windows code is quite happy to use "/" as well. In any case, since the path is "/home/userrig/test/loops", the correct code is

String filePath = "/home/userrig/test/loops";
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the clarification. It was useful.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gopu Akraju please UseRealWords.
B'cos is not a real word.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic