File file = new File("D:\\config");
if (fileisDirectory()) {//判断是否文件夹
File[] files = filelistFiles();
if(fileslength > 0){
for(File f : files){
Systemoutprintln(fgetName());
}
}
}
如果需要往下到每一级的话,可以写个方法递归调用就行了。
DirectoryInfo
di
=
new
DirectoryInfo(@"文件夹路径");
diGetDirectories();//获取子文件夹列表
diGetFiles();//获取文件列表
用dropdownlistbox的dirlist函数
long ll_count,ll_row
string ls_file,is_file[],is_folder[]
ddlb_1dirList("D:\tonny");
ll_count= ddlb_1totalitems()
for ll_row=1 to ll_count
ls_file =ddlb_1getitem(ll_row)
if isdirectory(ls_file) then
is_folder[upperbound(is_folder)+1]=ls_file
else
is_file[upperbound(is_file)+1]=ls_file
end if
end for
#!/bin/tcsh -f
if( -e rinex)then
echo "file have been changed"
exit
else
echo "please wait for moment"
mkdir rinex
set new_path="/rinex/"
find > filename1txt
@ count=1
@ dount=1
while( -s filename$counttxt)
set row=`sed -n 1p filename$counttxt`
@ len=`expr length $row`
set last_letter=`expr substr $row $len 1`
if($last_letter == "Z")then
@ dount=$count
@ count=$count + 1
cp $row $new_path
@ len=$len - 13
set dfile=`expr substr $row $len 12`
gunzip $new_path$dfileZ
crx2rnx $new_path$dfile
rm $new_path$dfile
sed -e '1d' filename$dounttxt > filename$counttxt
rm -f filename$dounttxt
else
@ dount=$count
@ count=$count + 1
sed -e '1d' filename$dounttxt > filename$counttxt
rm -f filename$dounttxt
endif
end
rm -f filename$counttxt
endif
以上就是关于java怎么读取父文件夹下面所有子文件夹或文件的名字跪求代码~全部的内容,包括:java怎么读取父文件夹下面所有子文件夹或文件的名字跪求代码~、C#怎么获取当前文件夹的子文件夹和文件的名字、pb 如何获取指定路径下所有文件的文件名(含子文件夹内的文件)等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)