my dog learned polymorphism*
The moose likes Beginning Java and the fly likes How to get the directory list from linux system? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to get the directory list from linux system?" Watch "How to get the directory list from linux system?" New topic
Author

How to get the directory list from linux system?

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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";


[Jess in Action][AskingGoodQuestions]
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
Thanks for the clarification. It was useful.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hi Gopu Akraju please UseRealWords.
B'cos is not a real word.


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the directory list from linux system?
 
Similar Threads
display data from linux smps
jar file execution in linux.
how to check whether a file exists in a directory?
include and file path
zehon FTP Files Transfered successfully but folder relative to home