Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Renaming Dir
Message
From
22/05/2001 07:04:57
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgia, United States
 
 
To
21/05/2001 15:41:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00509442
Message ID:
00509795
Views:
22
>>>Is there a way to rename a directory (ie simulate the right click->rename in win 95 98. Can it be done from inside VFP? can it be done in a the batch/icon file that calls up a VFP app?
>>>
>>>
>>>TIA
>>>CG
>>
>>Off hand, I can't think of a FoxPro command that will change a directory name, but
>>1. I imagine you could do it through the Win API or Windows Scripting Host.
>>2. You can use RUN to use the operating system's REN command.
>>3. While you can certainly create and run this VFP app from an icon, it seems like a lot of overhead and time spent loading a VFP application to change a directory name.
>
>I have a client who has a long running ap with directories \myapp and \myappsdata. They ordered a second system which was bacisally a copy of the first with modifications. It ran on another computer and used the same \myapp and \myappsdata directories.
>
>Now they need to have them both on the same machine, but never need them both in use. My alternate to recoding was having them simply rename directories, and I was trying to automate that for them.
>
>CG

I get it. I'm sorry, I misunderstood and thought you were thinking of writing a FoxPro app to change directory names. Yes, you can acomplish what you are describing with a bat file - if you don't mind a DOS window appearing momentarily. To run the new MyApp2.exe:
ren myapp myapp1
ren myappdata myappdata1
ren myapp myapp2
ren myappdata myappdata2
ren myapp2 myapp
ren myapp2data .myappdata
cd \myapp
MyApp.exe
Of course you could get fancier and check for the existence of the directories rather than just renaming them.

Or you could write a header program in FoxPro to change the directory using the Windows API or WSH as outlined previously and run the application. It would look better than a DOS window opening up. That way the user would have an icon for each app that ran the FoxPro app, just like they expected.
David.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform