Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't add folder name w/ a space programatically
Message
De
24/07/2000 08:48:18
 
 
À
24/07/2000 08:39:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00396092
Message ID:
00396096
Vues:
10
>Hello everyone,
>I have an annoying little problem here. My company's file structure on the server has a main customer folder, and then most companies who are our customers have their own folder inside that main folder. For those that don't already have a folder though, my program needs to be able to add thier folder with the name being their 6-character company code. The problem now is that some of the companies have a space in their company code, and the MKDIR and MD commands don't allow me to properly add these folders.
>
>You see the DIRECTORY() function will tell me that folder:
>
>k:\customer\BUZZ 1\forms
>
>does not exist. Then I say:
>
>MKDIR k:\customer\BUZZ 1\forms
>
>and a folder is created named 'k:\customer\BUZZ', because it doesn't recognize anything after the space! It seems that DIRECTORY() interprets the command correctly, but MKDIR, and MD don't like it. Does anyone know a way around this?

You need to use name resolution; the VFP parser is treating the space as a delmitier. Try:

MKDIR ("k:\customer\buzz 1\forms")

You can stick the directory in a string variable and use that:

cMyDir = "k:\customer\buzz 1\forms"
MKDIR (cMyDir)

Using macro expansion will not work reliably because of the parsing issue:

cMyDir = "k:\customer\buzz 1\forms"
MKDIR &cMyDir && screws up
MKDIR "&cMyDir" && works
cMyDir = "c:\Foo"
MKDIR &cMyDir && works
MKDIR "&cMyDir" && screws up

Name resolution doesn't have the parsing issues with or without a space.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform