| | Submitted on: 9/2/2003 9:55:56 PM
By: Suhail
Level: Beginner User Rating:
By 1 Users Compatibility:Java (JDK 1.2)
Users have accessed this article 2145 times. | (About the author) |
| | Prints files in the current directory...with out any special file handling routines??!!! | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. | /* By running the following program at the command prompt
/* you can list all the files in the current directory
/* I found this code some where and thought of sharing it
/* I'm sure this will help, those who know not, take a step further in /* understanding Java
/* Syntax :
/* type "java listfiles *" at the command prompt
/* On unix type "java listfiles.*"
/* don't forget space and star!!!
class listfiles
{
public static void main(String args[])
{
for(int i=0;i< args.length; i++)
System.out.println("File" + i + ":" + args[i]);
if(args.length<=0)
System.out.println("No files!");
}
}
| |
Other 12 submission(s) by this author
|
|
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
11/17/2003 11:16:14 AM: Now that is interesting. How does it
get the directory listing?
|
11/17/2003 11:52:16 AM:ICode Thx, good trick. Must be something
built into Java where it defaults to
system commands if no other use of
parameters... Wonder if it is only
limited to directory commands?
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|