Tough time with MakeDirectory


BeeHay

Recommended Posts

Hello again AzeoTech!

I'm having a tough time with something I would think is rather simple...

I'm trying to make the export location user settable from within the user interface...

I have an Edit Box setup to accept the users input for a desired export location...

I have a global string setup called strFolderName...

I also have a sequence setup to run when the user clicks a "set" button...

This is the sequence that runs -

File.MakeDirectory(strFolderName)

Export.MyExport.FileName = strFolderName

Now I can set strFolderName to something basic like "test", but when I try to make it a drive location "C:\wellnumber\wellname\export" it will not accept that value....

I keep getting this error -

C1125 Unable to create directory: MakeDir Line 1 - Uncaught error in sequence MakeDir

Bonk me on the head again Guru!

Any insight is helpful...

(p.s. I clicked my set button a bunch of times and got it to set once or twice, but now all I get is the error)

Thanks!!

Link to comment
Share on other sites

Not completely sure, I'd need more data. I will tell you this:

1) you'll get an error if the directory already exists

2) you'll get an error if the parent doesn't exist. So, if you try and make "C:\wellnumber\wellname\export", wellname must already exist. You can see this if you try and do md at a dos prompt.

Link to comment
Share on other sites

Here is a small .ctl file with what I'm trying to do...

I'm just trying to be able to change the built in export sets location and name, and leave the file with-out file extension (i.e .txt, .csv, just want no extension)...

Not sure if I can do this with the built in exports, I might have to break down and manually export my data in sequences with the file. functions...

Any point in the right direction would be great!

Thanks for the fast reply...

Link to comment
Share on other sites

I just keep getting "Unable to create directory" with any location I try....(maybe a Windoze Vista issue??)

I did notice that I can set the export location in DF easily and it accepts the input fine, just trying to create the directory where the file will be is giving me a tough time...

Say I set the export location and the export fires, there will be no data because the file location doesn't exist...

So all I am really trying to do is, set the export output location, and make the directory for it to place the export file in...

I flipped the 2 lines of code -

Export.Export1.FileName = FolderName

delay(1)

File.MakeDirectory(FolderName)

- and the Export.Export1.FileName works fine, it is just not creating the directory for the file...

Attached is the .ctl file again, but with the code flipped like above...Like I said, export.export1.filename works great, just making the directory doesn't "click"...

Hope I'm making sense, if not, I have fallen off the loony wagon! :D

Thanks for putting up with me for so long AzeoTech, I woulda beat me senseless already if I was you! :)

Link to comment
Share on other sites

Try just manually creating directories from the command/alert window:

File.MakeDirectory("c:\test")

for example and see what fails and what works. It may be that your Vista security doesn't like you creating directories off the root (with a full path).

Link to comment
Share on other sites

Ahh, I see...You explained it in an earlier post and I guess I was confused -

2) you'll get an error if the parent doesn't exist. So, if you try and make "C:\wellnumber\wellname\export", wellname must already exist. You can see this if you try and do md at a dos prompt.

Didn't know you couldn't create a directory with folders in it all in one shot. :)

Thanks for the help!

Link to comment
Share on other sites

Hrm, I tried your "md at dos prompt", and I am able to create a directory with folders in it all in one shot no problem...I thought it was possible, but this isn't the reason for my posting...

Now that I have the export "location" working, I am now encountering an issue where the export "file" is not being created...

When the export fires, all I am getting is "C1013 Problem logging to data file: c:\testing\export"...

I notice if I set the location "behind the scenes" in dev mode, DF automatically starts a new file upon firing...

I have also tried setting Export.MyExport.strFileName to something like C:\testing\export.txt, but all it does is make a folder called export.txt...

Any insight is helpful, I thought making my export location would be cake, not sure what I'm not seeing here!! :)

Thanks for everything!

Link to comment
Share on other sites

Here ya go...

I just tested it by leaving the created folder empty and clicking the "Run Export" button...

I got the error...

I then went into the created folder, made a .txt file of the desired export name, I then removed the .txt extension, then clicked the "Run Export" button, the export fired with no error, and there was a new line of data in the file...

Thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.