Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

renameming a folder

I have a installation pakage,I am using the depoyment wizard to create it.
I need to rename the old folder that the application used to install to,the in the dp wizard i will set the path to be the renamed folder.

I have a installation procees that is spawnd when i run my exe. I need to put the renaiming code in there how do i do this
0
Vignette
Asked:
Vignette
1 Solution
 
Ryan ChongCommented:
Try:

Dim a As String, b As String

a = app.path & "\a"
b = app.path & "\b"
Name a As b
0
 
yongyihCommented:
in load method of the first form display on screen, put:

Name app.path as "c:\new Folder"

Hope this can help...
0
 
VignetteAuthor Commented:
I am new to application dev.

what does app.path relate to.

what are all the different paths
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
vinnyd79Commented:
yongyih, how can you name the folder that you are running your app from to something else?I don't think you can because the app is in use.

app.path relates to the directory where your app is being run from.If you are running in VB's IDE then it will be the location of your project file(.vbp) If you are running a compiled .exe then it will be the location of your .exe file.

You can test this out by using a message box in your form load event:
MsgBox = app.path
0
 
yongyihCommented:
app.path will return the path of your exe file.
if your program in c:\temp, it will return "c:\temp"

to: vinnyd79
  i tried it just now. i create a new project that has a button.  the code in this button is:

  Name App.Path As "c:\temp2"

then i create an exe file for this project and copy it to c:\temp

  then, i run the program in c:\temp folder and click the button.  No error.  Then i go drive C.  The c:\temp  folder is rename to c:\temp2.

  So, i think should be no problem. If this is not what you mean, please explain again, Thank. ^_^
0
 
VignetteAuthor Commented:
I have tested the app.path function this is not going to work in my case.

I am using the FileSystemObject to find the folder.

For some reason its not finding the folder my code looks something like this

 Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM FAP GENERATOR\"
MsgBox sFilePath
MsgBox App.Path
 If oFileSystemObject.FileExists(sFilePath) Then
    MsgBox sFilePath
   vbLogEventTypeInformation
  End If


Can anyone help me.
Would this work for windows 98 and 2000 machines
0
 
VignetteAuthor Commented:
Sorry My code was wrong

it should read

Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM FAP GENERATOR\"
MsgBox sFilePath
MsgBox App.Path
If oFileSystemObject.FolderExists(sFilePath) Then
  'rename folder

 End If
0
 
VignetteAuthor Commented:
Hi I have fixed the prob thanks for all your guys help this is the code i am using.

Will this work on windows 98 machines aswell


Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM DOCUMENT GENERATOR\"
MsgBox sFilePath



 If oFileSystemObject.FolderExists(sFilePath) Then
   
    Dim a As String
    Dim b As String
   
    a = sFilePath
    b = "c:\Program Files\PWM GENERATOR\"
 
   Name a As b
   
   MsgBox b
  End If
0
 
VignetteAuthor Commented:
thanks for the answer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now