Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Getting names of files in a folder
Darrell Morello
Ranch Hand
Posts: 38
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all.
How do I get
Java
to display a list of files in an already set folder. For example there are three files with jtg extensions and I want all the file names to be displayed.
Thanks
nana Amr
Ranch Hand
Posts: 53
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hii,
try this:
String dir="D:/New Folder/"; //where New Folder contain files File files=new File(dir); //creat a file for the given dir if(files.isDirectory()) //chech if it is an Directory { String fileNames[]=files.list(); //return a list of file names for(int j=0;j<fileNames.length;j++){ String childDir=dir+"/"+fileNames[j]; //dir for the file fileNames[j] File childfile =new File(childDir); String fileName=""; fileName="\""+childDir+childfile.getName()+"\""; System.out.println(fileName); }
[ May 23, 2005: Message edited by: nana mm ]
[ May 23, 2005: Message edited by: nana mm ]
Darrell Morello
Ranch Hand
Posts: 38
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thats great!
Thanks
nana Amr
Ranch Hand
Posts: 53
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Applet works in browser, but not in Appletviewer
here's the task i'm trying to accomplish.. how to read directories and files withJSP
Display all files in an online folder?
two questions about class path and running.
jsp design question
More...