/**
* Get the all the filenames with absolute path
* All the files fullpath will be store in vector
* @return the path name
*/
public static void getFilesRecursive(File dir,Vector v)
{
if(dir.isDirectory())
{
String path = dir.getAbsolutePath();
String sub[] = dir.list();
for(int i = 0;i<sub.length;i++)
{
File f = new File(path + File.separator + sub[i]);
getFilesRecursive(f,v);
}
}
else
{ String tmp = dir.getAbsolutePath();
v.add(tmp);
//System.out.println(tmp);
} }
Vector v = new Vector();
out.println(getFilesRecursive("yourpath",v).size());
* Get the all the filenames with absolute path
* All the files fullpath will be store in vector
* @return the path name
*/
public static void getFilesRecursive(File dir,Vector v)
{
if(dir.isDirectory())
{
String path = dir.getAbsolutePath();
String sub[] = dir.list();
for(int i = 0;i<sub.length;i++)
{
File f = new File(path + File.separator + sub[i]);
getFilesRecursive(f,v);
}
}
else
{ String tmp = dir.getAbsolutePath();
v.add(tmp);
//System.out.println(tmp);
} }
Vector v = new Vector();
out.println(getFilesRecursive("yourpath",v).size());
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货