aspose file tools
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
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 24081
    
  15

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: 2562
    
    2

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


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