VFP怎么测试文件夹中是否还有文件?

来源:百度知道 编辑:UC知道 时间:2024/05/17 00:47:45
也就是怎么测试一个文件夹中是否为空?

* 假定要测试文件夹名是:"d:\ls\"
SET DEFAU TO D:\LS &&要测试文件夹设置为默认路径
FC=ADIR(A,'*.*')
IF FC=0
WAIT WINDOW '文件夹中为空'
ELSE
WAIT WINDOW '文件夹中文件数:'+STR(FC,4)
ENDIF
* 重新设置默认路径
cCurrentProcedure = SYS(16,1)
nPathStart = AT(":",cCurrentProcedure)- 1
nLenOfPath = RAT("\", cCurrentProcedure) - (nPathStart)
SET DEFAULT TO (SUBSTR(cCurrentProcedure, nPathStart, nLenofPath))