Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename file using parameters
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00591399
Message ID:
00591437
Views:
22
This message has been marked as a message which has helped to the initial question of the thread.
>>>>Simply get a object reference to the file and change its Name property like this
oFSO = CREATEOBJECT("Scripting.FileSystemObject")
>>>>oFile = oFSO.GetFile((GETFILE("*")))
>>>>? oFile.Name
>>>>oFile.Name = FORCEEXT(oFile.Name, 'DBF')
>>>>? oFile.Name
Naturally, in VBScript you'd get the object references using Set.
>>>>
>>>>Why would you need two parameters?
>>>
>>>I need to call this code with the old file name and the new file name. In fact, I need to create a file with a long name in Fox Pro 2.6, so my idea was to write a copy file tool that takes the two parameters.
>>
>>Then you'd just need to change the ShortName property of the file object reference. There's also ShortPath as well as Path.
>
>The problem is, that FoxPro2.6 just strips off the latter part of the file name. I can only create a file like
>FHndl = FCREATE("ShortFil.txt")
>
>In order to create a file with the name "VeryLongNow.txt" I need to call a 32 bit application like:
>! /N RenameFile("ShortFil.txt","VeryLongNow.txt") because there is no other way in FoxPro 2.6.

I'm not exactly certain what you're doing, but based on one of Ed Rauh's posts yesterday, I'd think you might be able to do it by using the RUN command to call cscript.exe passing it the name of a vbs file that would do the work for you. This could be a vbs file that your program generates and sets the Name property. It'd use the short name to get the file reference and set the name property.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform