如果创建的文件夹已经存在,可以先删除,再创建。这样就不会出现错误信息了吧。
坚守VFP最后的阵地
SET DATE ANSI SET MARK TO "-" CLEAR ALL CLEAR ? myCreateDirectory("Backup\" + DTOC(DATE())) CLEAR ALL RETURN #DEFINE ERROR_SUCCESS 0x00 #DEFINE ERROR_PATH_NOT_FOUND 0x03 #DEFINE ERROR_ACCESS_DENIED 0x05 #DEFINE ERROR_ALREADY_EXISTS 0xB7 FUNCTION myCreateDirectory(tcDirectory) LOCAL lnResult DECLARE Integer CreateDirectory IN WIN32API String @cDirectory, Integer nAttributes DECLARE Integer GetLastError IN WIN32API lnResult = ERROR_SUCCESS IF CreateDirectory(tcDirectory, 0) == 0 lnResult = GetLastError() ENDIF RETURN lnResult ENDFUNC