Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem in Creating Directory
Message
From
17/11/2017 22:56:51
 
 
To
17/11/2017 16:01:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01655649
Message ID:
01655657
Views:
60
>I want to Create a Directories in The Name of a Files at inside my Desired Location i.e sDirectory. Here is the code I am Using.
>
>
>
>DECLARE INTEGER CreateDirectory IN kernel32;
>STRING lpPathName, STRING @lpSecurityAttr
>
>sDirectory='D:\Data\Files'
>OriginalFile=E:\Data\123.pcl
>OriginalFile=E:\Data\456.pcl
>
>
>SET DEFAULT TO (sDirectory)
>CreateDirectory(JUSTSTEM(OriginalFile),0) && Does Not Create any Directory with the Required FileName
>cDIR=JUSTSTEM(OriginalFile)
>CreateDirectory('&cDIR',0) && && Does Not Create any Directory with the Required FileName
>CreateDirectory('cDIR',0) && Gives Creates a Directory with Name cDIR and Not in the Name of The File
>CreateDirectory(&cDIR,0) && Gives Error Data Type Mismatch
>CreateDirectory(cDIR,0) Does Not Create any Directory with the Required FileName
>
>
>None of the above is creating the Directory with File Name inside sDirectory. However, if I use CreateDirectory('123',0) it works fine,
>
>What Syntax To be Used I need to create Directory inside my Desired Location Like "sDirectory\123"and "sDirectory\456"
>
>Thanks

Did you intend to write:
OriginalFile=E:\Data\123.pcl
OriginalFile=E:\Data\456.pcl
or did you actually mean to write
OriginalFile='E:\Data\123.pcl'
OriginalFile='E:\Data\456.pcl'
also, as Mike had suggested, perhaps you should consider using the built-in MD/MKDIR command in VFP rather than API call -- generally better idea to use built-in rather than external (unless there is a specific reason to do so -- e.g. built-in command has limitation). One other thing -- you'll have to be careful about relative directory addressing -- especially when API calls are involved, or when anything outside of FoxPro is used. I've seen situations where the "current directory" could change unexpectedly. When there is a doubt, it's probably a good idea to use full paths.
Previous
Reply
Map
View

Click here to load this message in the networking platform