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:29:23
 
 
To
24/10/2006 13:14:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01164128
Message ID:
01164133
Views:
9
>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
if ADir(temp,JustPath('C:\X\Y\A.*'),"D")=0
  messagebox('Master directory does not exist')
else
  if ADir(temp,JustPath('A:\X\Y\A.*'),"D")=0
    md (JustPath('A:\X\Y\A.*'))
    COPY FILE 'C:\X\Y\A.*' TO 'A:\X\Y\A.*'
  endif
endif
or more generic:
lcMasterfile='C:\X\Y\A.*'
lcTargetfile='A:\X\Y\A.*'
if ADir(temp,JustPath(lcMasterfile),"D")=0
  messagebox('Master directory does not exist')
else
  if ADir(temp,JustPath(lcTargetfile'),"D")=0
    md (JustPath(lcTargetfile))
    COPY FILE (lcMasterfile) TO (lcTargetfile)
  endif
endif
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform