Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Handling directories from FoxPro 2

Status
Not open for further replies.

jschenke

Programmer
Jun 19, 2001
48
BE
Hi all,
I'm new to this forum, but hope to eventually be able to contribute something rather than asking :)

I am writing an import program that involves reading 1 text file into 4 separate 'temporary' dbf files, which are on approval appended into the 'real' datafiles.
No problems there, but I have to keep backup copies of the temporary files so everything can be traced back later in case of troubles.
I have to move these files into a *new* directory with the sequence number of the import; eg "C:\MYDATA\LUM00001\"

Since there is no MOVE FILE command, my guess is I have to use COPY FILE and then DELETE FILE to get rid of the original. (sigh) But how can I create a new directory?
COPY FILE won't create the directory for me and treat me to an error when I try. Asking the user where to backup the files is (unfortunately) no option.

Oh, and to top it all off, this solution needs to work on both Windows and MacOS.

Thanks for your help,

Jan.
 
foxtools.fll has a MKDIR command.
See the foxtools.wri file installed into your fpw26 directory.

Nigel
 
Thanks Nigel, I should be able to get it to work now; I had bumped into it somewhere in old source code, but when i tried it in the command window it wouldn't work; i just noticed it does work however from within another .prg file (the joys of foxpro coding, right?))
Anyway, thanks again for your help!

Jan.
 
You'll need to include a SET LIBRARY TO command to use foxtools. The following example assumes Foxtools is in the install directory (where it should be by default):

IF FILE(SYS(2004) + 'foxtools.fll')
SET LIBRARY TO SYS(2004) + 'foxtools.fll'
ELSE
WAIT WINDOW 'Error - Unable to locate library ' + ALLTRIM(SYS(2004)) + 'foxtools.fll'
ENDIF

cheers,

Nathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top