Java遍历目录

[ 2006-06-13 21:32:18 | Author: zhenhua ]
Font Size: Large | Medium | Small
收集,未经测试
1.
File pa=new File("目录名");
String[] cc=pa.list();
for(int i=0;i<cc.length;i++)
 System.out.println(cc[i]);

2.
String url1="C:/aaa";
File[] file=(new File(url1)).listFiles();
 for(int i=0;i<file.length;i++){
 if(file[i].isFile()){
 file[i].toString();
out.println((file[i].getName()).toString());
 }
}

3.
File f = new File("c:/");
 File[] sub = f.listFiles();
 for(int i =0;i<sub.length;i++){
 if(sub[i].isDirectory() ){continue;}
 System.out.println(sub[i]);
 }

取后缀
int i=FileName.lastIndexOf(".");
String houzhui=FileName.substring(i+1);
Comments Feed Comments Feed: http://www.zhenhua.org/feed.asp?q=comment&id=358
UTF-8 Encoding Trackback URL: http://www.zhenhua.org/trackback.asp?id=358

View Mode: Show All | Comments: 0 | Trackbacks: 388 | Toggle Order | Views: 19869
Trackback order botox wholesale
[ order botox wholesale | 2012-11-19 03:15:35 ]
Brand and Generic Drugs, Discount Pharmacy. All information about order botox wholesale in one place: http://digilander.libero.it/fuoco110/botox/order-botox-wholesale.html
Trackback rockville montelukast
[ rockville montelukast | 2012-11-21 02:40:18 ]
Brand and Generic Drugs, Discount Pharmacy. All information about rockville montelukast in one place: http://digilander.libero.it/ftp2007/montelukast/rockville-montelukast.html
Trackback elavil sleep
[ elavil sleep | 2012-12-01 01:33:37 ]
Brand and Generic Drugs, Discount Pharmacy. All information about elavil sleep in one place: http://xmed.de.ki/valium/elavil-sleep.html
Trackback generic drugs
[ generic drugs | 2012-12-15 10:31:24 ]
Brand and Generic Drugs, Discount Pharmacy. All information about generic drugs in one place: http://ravers.snn.gr/xenical/generic-drugs.html
Trackback arrhythmia
[ arrhythmia | 2012-12-20 21:10:06 ]
Brand and Generic Drugs, Discount Pharmacy. All information about arrhythmia in one place: http://perso.wanadoo.es/valleinclan5/caverta/arrhythmia.html
Trackback buy tramadol
[ buy tramadol | 2013-01-26 03:00:25 ]
Brand and Generic Drugs, Discount Pharmacy. All information about buy tramadol in one place: http://perso.wanadoo.es/hdem_ingenieria/tramadol/buy-tramadol.html
Trackback actos diabetes plus
[ actos diabetes plus | 2013-02-08 10:10:58 ]
Brand and Generic Drugs, Discount Pharmacy. All information about actos diabetes plus in one place: http://digilander.libero.it/thestorytellers/actos/actos-diabetes-plus.html
Trackback diovan hct 80 mg
[ diovan hct 80 mg | 2013-02-21 04:07:31 ]
Brand and Generic Drugs, Discount Pharmacy. All information about diovan hct 80 mg in one place: http://utenti.multimania.it/barili/diovan-hct/diovan-hct-80-mg.html
Trackback weight loss drugs
[ weight loss drugs | 2013-03-01 10:04:04 ]
Brand and Generic Drugs, Discount Pharmacy. All information about weight loss drugs in one place: http://plass.altervista.org/didrex/weight-loss-drugs.html
Trackback salem clomid
[ salem clomid | 2013-03-04 01:33:57 ]
Brand and Generic Drugs, Discount Pharmacy. All information about salem clomid in one place: http://heelen.altervista.org/clomid/salem-clomid.html
Trackback carmichael cefuroxime
[ carmichael cefuroxime | 2013-03-10 10:35:47 ]
Brand and Generic Drugs, Discount Pharmacy. All information about carmichael cefuroxime in one place: http://malfit.altervista.org/cefuroxime/carmichael-cefuroxime.html
Trackback anderson clarithromycin
[ anderson clarithromycin | 2013-03-20 09:30:38 ]
Brand and Generic Drugs, Discount Pharmacy. All information about anderson clarithromycin in one place: http://argall.altervista.org/clarithromycin/anderson-clarithromycin.html
Trackback rhinocort nasal inhaler
[ rhinocort nasal inhaler | 2013-04-18 07:12:01 ]
Brand and Generic Drugs, Discount Pharmacy. All information about rhinocort nasal inhaler in one place: http://hem.passagen.se/niklot/rhinocort/rhinocort-nasal-inhaler.html
Trackback lowest price
[ lowest price | 2013-05-07 21:53:46 ]
Brand and Generic Drugs, Discount Pharmacy. All information about lowest price in one place: http://mitglied.multimania.de/churon/tretinoin/lowest-price.html
Trackback zolpidem dosage
[ zolpidem dosage | 2013-06-04 09:23:15 ]
Brand and Generic Drugs, Discount Pharmacy. All information about zolpidem dosage in one place: http://condon.altervista.org/zolpidem/zolpidem-dosage.html
Trackback phendimetrazine mexico
[ phendimetrazine mexico | 2013-06-13 18:33:15 ]
Brand and Generic Drugs, Discount Pharmacy. All information about phendimetrazine mexico in one place: http://knipe.altervista.org/phendimetrazine/phendimetrazine-mexico.html
Trackback mansfield levothyroxine
[ mansfield levothyroxine | 2013-06-29 11:35:46 ]
Brand and Generic Drugs, Discount Pharmacy. All information about mansfield levothyroxine in one place: http://roxica.altervista.org/levothyroxine/mansfield-levothyroxine.html
Trackback what is combivent
[ what is combivent | 2013-07-16 07:52:06 ]
Brand and Generic Drugs, Discount Pharmacy. All information about what is combivent in one place: http://perso.wanadoo.es/macico7/combivent/what-is-combivent.html
Trackback nexium
[ nexium | 2013-08-02 08:37:17 ]
Brand and Generic Drugs, Discount Pharmacy. All information about nexium in one place: http://hem.passagen.se/tjadden1/nexium/
Trackback finasteride tabs 30s
[ finasteride tabs 30s | 2013-08-25 08:22:11 ]
Brand and Generic Drugs, Discount Pharmacy. All information about finasteride tabs 30s in one place: http://round.de.ki/finasteride/finasteride-tabs-30s.html

If you feel this site you find this information helpful, please click on the donation, which is voluntary,Thank you.
Post Comment
Smilies
[arrow] [biggrin] [confused] [cool]
[cry] [eek] [evil] [exclaim]
[frown] [idea] [lol] [mad]
[mrgreen] [neutral] [question] [razz]
[redface] [rolleyes] [sad] [smile]
[surprised] [twisted] [wink]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code