远程访问,我没有做过
本机的,有用的话,楼主去改改把
import java.io.*;public class FindFileBean
{
static public boolean FindFile(String str){
try
{
File pathName=new File("file://14.132.23.1/c:/document");//初识文件夹
String[] fileNames=pathName.list();
//enumerate all files in the directory
for (int i=0;i<fileNames.length;i++)
{
File f=new File(pathName.getPath(),fileNames[i]);
if(f.getCanonicalPath().endsWith(str))//如果找到目标文件
{
return true;
}
//if the file is again directory,call the main method recursively
if(f.isDirectory())
{
FindFile(new String[]{f.getPath()});
}
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
本机的,有用的话,楼主去改改把
import java.io.*;public class FindFileBean
{
static public boolean FindFile(String str){
try
{
File pathName=new File("file://14.132.23.1/c:/document");//初识文件夹
String[] fileNames=pathName.list();
//enumerate all files in the directory
for (int i=0;i<fileNames.length;i++)
{
File f=new File(pathName.getPath(),fileNames[i]);
if(f.getCanonicalPath().endsWith(str))//如果找到目标文件
{
return true;
}
//if the file is again directory,call the main method recursively
if(f.isDirectory())
{
FindFile(new String[]{f.getPath()});
}
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
myform.action="14.132.23.1/?.jsp";