pb8.0-9.0获取指定目录下的所有的文件和目录

javastart 2003-10-23 09:43:56
pb8.0-9.0获取指定目录下的所有的文件和目录
...全文
177 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qqjj7758 2003-10-23
  • 打赏
  • 举报
回复
看看
佣工7001 2003-10-23
  • 打赏
  • 举报
回复
只能用api涵数,给你一个例子
//====================================================================
// 函数[Function]:- of_deletefiles for nvo_winapi
//--------------------------------------------------------------------
// 描述[Description]:删除一个目录下指定的一类文件,EX:"C:\TEMP\*.TXT"
//--------------------------------------------------------------------
// 参数[Arguments]:
//
// 参数(1): string filespec
// <description>
//--------------------------------------------------------------------
// 返回值[Returns]: (INTEGER)
//--------------------------------------------------------------------
// 作者[Author]: dajianshi 日期[Date]: 2000年05月30日
//====================================================================
long rtn,p,FindHandle;
WIN32_FIND_DATAA fd;
string fs,fname,lpathname,tagFile[];
fs = filespec;
lpathname = reverse(fs);
if pos(lpathname,"\")< 0 then
p = pos(lpathname,'/')
else
p = pos(lpathname,'\');
end if
if p>0 then
lpathname = mid(lpathname,p);
end if
lpathname = reverse(lpathname);

rtn = FindFirstFile(fs,ref fd);
FindHandle = rtn;
if rtn < 0 then
rtn = GetLastError();
if rtn<> 2 then
of_showwindowerror()
return rtn;
else
return 1 // NO such files then no need delete;
end if
end if
do while rtn >0
fname =string(fd.cfilename)
if fname='.' or fname='..' then
else
fname = lpathname+fname;
tagFile[upperbound(tagFile)+1] = fname;
end if
rtn = FindNextFile(FindHandle, ref fd);
if rtn = 0 then
rtn = GetLastError();
if rtn<> 18 then // NO more files match and no this file
of_showwindowError();
messagebox('next',fname);
return -1
else
rtn=0
end if
end if
loop
FindClose(findHandle);
//messagebox('to delete',fname);
for p = 1 to upperbound(tagFile)
of_setFileAttributes(tagFile[p],'a');
if not DeleteFile(tagFile[p]) then
of_showWindowError();
messagebox('错误!','删除文件:'+tagFile[p]+'时出错');
return -1;
end if
next
return 1;

1,076

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧