Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying files into a non-exsting folder
Message
From
24/10/2006 13:24:41
 
 
To
24/10/2006 13:14:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01164128
Message ID:
01164131
Views:
8
*--You can all together at once, but as Borislav showed, put it in a try catch...
lcDirectory = '\mydir\mydir2\mydir3'
IF !DIRECTORY(sys(5)+lcDirectory)
   TRY
      mkdir Sys(5)+lcdirectory
   CATCH
      *--Process the error
   ENDTRY
ENDIF
? DIRECTORY(sys(5)+lcDirectory)

*--Or one by one...
lcDirectory = '\mydir'
IF !DIRECTORY(sys(5)+lcDirectory)
   mkdir Sys(5)+lcdirectory
ENDIF
lcDirectory = '\mydir\mydir2'
IF !DIRECTORY(sys(5)+lcDirectory)
   mkdir Sys(5)+lcdirectory
ENDIF
* replace sys(5) with the drive letter and colon e.g. c: or d: or e: etc.
>The COPY FILE command does not seem to work if the destination folder deos not exist. For example if I use the command
>
> COPY FILE 'C:\X\Y\A.*' TO 'A:\X\Y\A.*'
>
>if either the folder "X" or the sub-folder "Y" do not exist. What is the best way of check that the destination folders exist and to create them if the do not?
>
>TIA
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform