cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
retzcat
Level 6

CreateDir Not working

I've been trying to get this to work for a while now, using several examples I've found on the boards here...
This is what I have
[FONT="Arial"]///////////////////////////
// MakeBackUpDirs
///////////////////////////
function MakeBackUpDirs()

number nReturn;
begin

nReturn= CreateDir(TARGETDIR + "\\Backup");
if nReturn = 0 then
NumToStr(sReturn, nReturn);
MessageBox ("Can not create backup directory under C:\Swisslog.",SEVERE);
abort;
endif;
[/FONT]
end;

IT will not create the directory....
Anyone have any ideas why?
Thanks
:mad:
Labels (1)
0 Kudos
(3) Replies
Tharkhaad
Level 3

One thing you might want to try is replacing:

nReturn= CreateDir(TARGETDIR + "\\Backup");

with:

nReturn= CreateDir(TARGETDIR ^ "Backup");

In the event that TARGETDIR is being resolved to "C:\Swisslog\".
0 Kudos
MGarrett
Level 6

And to find out more specifically why it is failing, use FormatMessage to get the error related to the error code, instead of the MessageBox.

SprintfBox(SEVERE, "Create Dir Error...", "Could not create backup directory under %s.\n" + "Error number: %d \n %s", TARGETDIR, nReturn, FormatMessage(nReturn) );
0 Kudos
retzcat
Level 6

I hadn't checked this yesterday... Thanks - I'll give each suggestion a try!:)
0 Kudos