当前位置: 技术问答>java相关
如何改变一个文件的当前目录???
来源: 互联网 发布时间:2015-04-15
本文导语: How can you change the current working directory using an instance of the File class called FileName? 1) FileName.chdir("DirName") 2) FileName.cd("DirName") 3) FileName.cwd("DirName") 4) The File class does not support directly changing the current...
How can you change the current working directory using an instance of the File class called FileName?
1) FileName.chdir("DirName")
2) FileName.cd("DirName")
3) FileName.cwd("DirName")
4) The File class does not support directly changing the current directory
1) FileName.chdir("DirName")
2) FileName.cd("DirName")
3) FileName.cwd("DirName")
4) The File class does not support directly changing the current directory
|
参考吧。
static public String Findfile(String dir,String to_find)
{
int i;
String results;
String dir_list[] = (new File(dir)).list();
for(i=0;i0) return results;
}
else
{
if((to_test.getName()).equalsIgnoreCase(to_find))
return to_test.getAbsolutePath();
}
}
return "";
}
static public String Findfile(String dir,String to_find)
{
int i;
String results;
String dir_list[] = (new File(dir)).list();
for(i=0;i0) return results;
}
else
{
if((to_test.getName()).equalsIgnoreCase(to_find))
return to_test.getAbsolutePath();
}
}
return "";
}