Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading from a directory

thatos's Avatar
Member
 
Join Date: Aug 2007
Location: SOUTH AFRICA
Posts: 91
#1: Jun 7 '08
I know how to read maybe values in files, but is there a way to for example get names of files in a directory and manipulate somehow this files?

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jun 7 '08

re: Reading from a directory


Quote:

Originally Posted by thatos

I know how to read maybe values in files, but is there a way to for example get names of files in a directory and manipulate somehow this files?

Did you read the API documentation for the File class? Your answer can
be found there.

kind regards,

Jos
BigDaddyLH's Avatar
Moderator
 
Join Date: Dec 2007
Location: Kelowna, BC Canada
Posts: 1,212
#3: Jun 7 '08

re: Reading from a directory


From Sun's tutorial: http://java.sun.com/docs/books/tutor...l/io/file.html
Member
 
Join Date: Oct 2007
Posts: 52
#4: Jun 9 '08

re: Reading from a directory


Hi, did you guys sometimes use those powerful java IDE's, they are open sources and they are very helpful with usage of java API's, currently eclipse is the best, for example if you declare something like:

Flile f = new File("path and file name ");

and if you type 'f.' and wait for a second, it will list all the operations that you can do or get from file object. hope this will help a lot that API's than asking API related question, he are hoping to get more program structures(OOP) related like inheritance, polymophism and encapsulation questions, remember PIE ....

Sam Rabophala
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#5: Jun 9 '08

re: Reading from a directory


Quote:

Originally Posted by samido

Hi, did you guys sometimes use those powerful java IDE's, they are open sources and they are very helpful with usage of java API's, currently eclipse is the best, for example if you declare something like:

Flile f = new File("path and file name ");

and if you type 'f.' and wait for a second, it will list all the operations that you can do or get from file object. hope this will help a lot that API's than asking API related question, he are hoping to get more program structures(OOP) related like inheritance, polymophism and encapsulation questions, remember PIE ....

Sam Rabophala

The OP didn't even know that s/he should use the File class; what is an IDE to do
then? If beginners followed up your advice this forum would be swamped with
question from people like "how do I so and so with my IDE?" All those IDEs
do is hide those basic mechanics for you but you still have to understand those
basics in order to work properly with an IDE.

The keyword here is "reading". People just don't read anymore before they start
typing and simply hope for the best which basically means they curse Java
because it doesn't work like visual basic does it. Posession of computers at
home should be made a grave felony.

kind regards,

Jos
thatos's Avatar
Member
 
Join Date: Aug 2007
Location: SOUTH AFRICA
Posts: 91
#6: Jun 9 '08

re: Reading from a directory


Thanks for your help, it really helped a lot, now I know what to do.
Member
 
Join Date: Oct 2007
Posts: 52
#7: Jun 17 '08

re: Reading from a directory


...you are still correct bt nothing aimed for the people to struggle a lot before they get how simple and efficient for the Java code to be implemented. we must still guide peple how to get this things easy and usable without going extra miles, when I start with developing carrier I used to ask my self how could people implement morethan 20 000 line of code per day... and you knows the answer...! Sam Rabophala
BigDaddyLH's Avatar
Moderator
 
Join Date: Dec 2007
Location: Kelowna, BC Canada
Posts: 1,212
#8: Jun 17 '08

re: Reading from a directory


Quote:

Originally Posted by samido

...you are still correct bt nothing aimed for the people to struggle a lot before they get how simple and efficient for the Java code to be implemented. we must still guide peple how to get this things easy and usable without going extra miles, when I start with developing carrier I used to ask my self how could people implement morethan 20 000 line of code per day... and you knows the answer...! Sam Rabophala

How I learned to program: C and Emacs, with Dennis Ritchie's book "The C Programming Language" by my elbow.
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#9: Jun 17 '08

re: Reading from a directory


Quote:

Originally Posted by BigDaddyLH

How I learned to program: C and Emacs, with Dennis Ritchie's book "The C Programming Language" by my elbow.

I use VI(M) so we're enemies for life; btw LOCs of code, as the previous replier
mentioned, is a very bad metric; I feel happy after a day of negative LOCs ...

kind regards,

Jos
Reply