Reply to Thread

Post a reply to the thread: Move an entire folder to another

Your Message

Click here to log in

What's the name of our main installation product (in uppercase letters), directly followed by the current year?

 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Topic Review (Newest First)

  • 10-15-2014, 09:18 AM
    LiquidIce

    Re: Move an entire folder to another

    Friedrich,

    I tried the message box when I was doing the first experiments and the output is the correct one, it gives me C:\Users\TheUserNameHere\.
    I cannot rename it because what I want to do is move the existing directory to the Documents directory where google drive will be syncing. If i just rename it, i cannot control google drive and tell it to sync that renamed folder. I don't know if I'm explaining myself...
    Ok, i'll try the USERPROFILE variable.

    Alejandro.
  • 10-15-2014, 06:25 AM
    linder

    Re: Move an entire folder to another

    Quote Originally Posted by LiquidIce View Post
    Assigned a variable to get System Info(%PROFILE%)
    Quick note: you have to use Get System Info(Expand Environment Variable) for "USERPROFILE" and NOT Get System Info(Expand Environment Variable) for "%PROFILE%".

    Friedrich
  • 10-15-2014, 06:09 AM
    linder

    Re: Move an entire folder to another

    Alejandro,

    Just for fun, display the value of "%PROFILE%\Google Drive" and "%PROFILE%\Documents\Google Drive Backup" using a "Display Message Box" command. Do you see the expected values? BTW, this is still a potential candidate for a support nightmare! You are doing a per-user operation here!

    BTW, just curious, why don't you just rename the original folder? Why do you copy all the files and subfolders?

    Friedrich
  • 10-15-2014, 05:34 AM
    LiquidIce

    Re: Move an entire folder to another

    Friedrich,

    I tried the following:
    Assigned a variable to get System Info(%PROFILE%) and what I did later was "Move Folder Tree "%PROFILE%\Google Drive" to "%PROFILE%\Documents\Google Drive Backup".
    What this does is crash the installer when it has to do the move folder tree process. If I try to run the compiler RUN again, it takes very long and it crashes, so I have to go to the Task Manager and end the process manually and start again.

    Alejandro.
  • 10-15-2014, 04:49 AM
    linder

    Re: Move an entire folder to another

    Hi Alejandro,

    Just let me know if you need help.

    Friedrich
  • 10-15-2014, 04:29 AM
    LiquidIce

    Re: Move an entire folder to another

    Hello Friedrich,

    I will try your previous method; getting the System info. I'm trying to find where to define the function now and i'll get back to you on the outcome.

    Alejandro.
  • 10-10-2014, 07:02 AM
    linder

    Re: Move an entire folder to another

    Alejandro,

    Quick info: the correct syntax to get the user's profile looks like the attached code snippet.

    WARNING: you still have a design issue. You should NOT do this. This will result in a support nightmare sooner or later (because you might access an incorrect profile).

    Friedrich
  • 10-10-2014, 06:49 AM
    linder

    Re: Move an entire folder to another

    By the way, here is another interesting and related reading:

    http://www.lindersoft.com/forums/showthread.php?t=44128

    Friedrich
  • 10-10-2014, 06:44 AM
    linder

    Re: Move an entire folder to another

    Alejandro,

    So you have created your own %USERPROFILE% runtime variable and then you read the current user's home directory into that variable, correct? How do you do this? And why are you using %%USERPROFILE%% (with the double %)? %%USERPROFILE%% is NOT a SetupBuilder runtime variable.

    And what you are trying to do (accessing "per-user" data from an elevated running setup application) is a serious design issue. It is simply not allowed in Windows.

    For example: a typical corporate environment scenario. The machine has an "Alejandro" Administrator account and a "JoeUser" Standard user account. You are logged-in as "JoeUser". Your own asInvoker manifested and non-elevated running applications can access the "c:\users\JoeUser" location, no problem. But what happens when you run an application elevated (e.g. your setup.exe)? Well, then over-the-shoulder will kick in and "switches" you to c:\users\Alejandro. You do NOT have access to "c:\users\JoeUser".

    Do you see where your design issue is? By Windows development guidelines, it is not allowed.

    Friedrich
  • 10-10-2014, 05:34 AM
    LiquidIce

    Re: Move an entire folder to another

    Friedrich,

    %USERPROFILE% is a runtime variable that takes you to the current user's home directory: C:\Users\USERNAME\
    What do you mean never do per-user actions? Because In previous actions of the installer, I make actions in the %%USERPROFILE%%/Documents and it works because it gets the current user that is logged in and does the necessary actions in his/her home directory..

    If you say its not possible, what's an alternative to getting the current logged user's home directory in order to do things?

    Regards,
This thread has more than 10 replies. Click here to review the whole thread.

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •