怎么检查目录是否存在

sjx0910 2002-06-24 09:54:24
现在我有这样一个问题,就是保存文件到c:\yh7\, 而现在c:\yh7这个目录又不存在,现在应该这样使它自动判断,并建立这个目录
...全文
111 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
hai523 2002-06-24
  • 打赏
  • 举报
回复
函数都能用的,如不能用
你把错误提示贴出来,研究研究
hai523 2002-06-24
  • 打赏
  • 举报
回复
string t='c:\dddd'
boolean tt
tt = gu_pub_func.uf_Directory_IsAvailable(t)
if tt = true then
messagebox('','存在')
else
gu_pub_func.uf_Directory_Create(t)
end if
hai523 2002-06-24
  • 打赏
  • 举报
回复
string t='c:\dddd'
boolean tt
tt = gu_pub_func.uf_Directory_IsAvailable(t)
if tt = true then
messagebox('','存在')
else
gu_pub_func.uf_Directory_Create(t)
end if
byfq 2002-06-24
  • 打赏
  • 举报
回复
最基本的,使用dirlist
sjx0910 2002-06-24
  • 打赏
  • 举报
回复
请问:在pb7中怎么判断这个目录是否已经存在
wumir 2002-06-24
  • 打赏
  • 举报
回复
pb8中新增directoryExists()
语法:DirectoryExists(directoryname)
功能:判断某目录是否存在。
参数:directoryname 将要判断的目录(string)
返回值:true 目录存在 false 反之

hai523 2002-06-24
  • 打赏
  • 举报
回复
string pathname
nvo_public_function my_function

pathname="c:\yh7"
my_function.uf_directory_create(pathname
hai523 2002-06-24
  • 打赏
  • 举报
回复
声明 变量
nvo_public_function my_function
my_function.uf_directory_create()
sjx0910 2002-06-24
  • 打赏
  • 举报
回复
好象不行啊!!
我先输入string pathname
pathname="c\yh7"
uf_directory_create(pathname)这样好象不行!!!
sjx0910 2002-06-24
  • 打赏
  • 举报
回复
hao de 我试试看
jiazhij 2002-06-24
  • 打赏
  • 举报
回复
那个API很好用啊
sjx0910 2002-06-24
  • 打赏
  • 举报
回复
那这个扩展库怎么用,能不能直接就用啊
sjx0910 2002-06-24
  • 打赏
  • 举报
回复
sjx0910@sina.com,我太感谢你了,海洋
sjx0910 2002-06-24
  • 打赏
  • 举报
回复
我又不要vb,我要的是pb里面的编程
hai523 2002-06-24
  • 打赏
  • 举报
回复
你的邮箱,给你一个扩展函数库,里边有你要的东西!快
sandand 2002-06-24
  • 打赏
  • 举报
回复
Api函数可以帮助你完成这一工作。CreateDirectory, CreateDirectoryEx

VB声明
Declare Function CreateDirectory& Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpNewDirectory As String, lpSecurityAttributes As SECURITY_ATTRIBUTES)
Declare Function CreateDirectoryEx& Lib "kernel32" Alias "CreateDirectoryExA" (ByVal lpTemplateDirectory As String, ByVal lpNewDirectory As String, lpSecurityAttributes As SECURITY_ATTRIBUTES)
说明
创建一个新目录
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数 类型及说明
lpTemplateDirectory String,指定一个模板目录的名字,从中复制默认属性(比如目录中文件的默认压缩方式)。如设为vbNullString,则表示不使用模板
lpNewDirectory String,新目录的名字
lpSecurityAttributes SECURITY_ATTRIBUTES,这个结构定义了目录的安全特性——如果操作系统支持的话
mxlmwl 2002-06-24
  • 打赏
  • 举报
回复
在pb8.0中可以用DirectoryExists来判断,具体你查一下pb自带的帮助,并可以用CreateDirectory来建立一个新的目录,此外,还有changedirectory...,你可要仔细的看一下啦:)

1,075

社区成员

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

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