Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Renaming a file name with a leading space
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00407286
Message ID:
00407311
Views:
19
This message has been marked as the solution to the initial question of the thread.
>Has anyone run into trouble while attempting to rename a file which has a leading space? I am receiving an error from Visual FoxPro that the file does not exist. I tried:
>
> lcPath = sys(5) + curdir()
> gnCount = adir(gaTifs, '*.tif')
> for nCounter = 1 to gnCount
> cOldName = lcPath + gaTifs(nCounter,1)
> cNewName = lcPath + substr(gaTifs(nCounter,1)3,6)
> rename &cOldName to &cNewName

Using macro-expansion unnecessarily has consequences; use name expansion instead where possible. This is likely to work:

RENAME (cOldName) TO (cNewName)

> endfor
>
>If we manually take out the leading spaces it works... Otherwise we get the file does not exist error.
>
>Any suggestions would be greatly appreciated!
>
>Thanks in advance,
>Maria
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform