Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending a file with spaces in the name to Recycle bin...
Message
From
05/02/2008 01:35:11
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
05/02/2008 01:13:39
Chris Sund
Silhouette Solutions
Utah, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Miscellaneous
Thread ID:
01289425
Message ID:
01289434
Views:
13
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform