Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending a file with spaces in the name to Recycle bin...
Message
De
05/02/2008 01:35:11
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
05/02/2008 01:13:39
Chris Sund
Silhouette Solutions
Utah, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Divers
Thread ID:
01289425
Message ID:
01289434
Vues:
14
>Hello,
>
>Can anyone point me to a thread, or give me some advice on how to send a file to the recycle bin. I was using...
>
>
>Delete File &jfile RECYCLE
>
>
>But it won't delete properly if there are spaces in the name. I found the following code to delete something with spaces, but it deletes the item permanately. There's no recourse if the user makes a mistake. Any help is appreciated.

Check "Name Expression Creation" in Help, though it doesn't say much there. The difference is that a macro substitution, i.e. a & will really be substituted before execution, and if jfile= "c:\path with spaces\file with spaces.txt", your command becomes
Delete File c:\path with spaces\file with spaces.txt RECYCLE
Since the spaces are a part of the syntax, Fox thinks you want to erase c:\path, and then stumbles upon "with", "spaces\file" and other unknown garbage. Name expressions, however, solve this:
Delete File (jfile) RECYCLE
is not substituted; it just means "name is stored in this variable". So whenever you encounter a situation that Fox may want a name of something (a file, window, alias, variable, array, field), you can have that name in a variable surrounded by parentheses. Try it out, it'll save you a lot of trouble.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform