Rename a folder from a string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Bruce
    Indigo Rose Customer
    • Jun 2001
    • 2134

    Rename a folder from a string

    I would like to rename a folder from a string that comes from a input called new_company_result. I'm forgeting something here.

    Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\New Company", _DesktopFolder.."\\IPT\\Offices\\new_company_result");
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3971

    #2
    Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\New Company", _DesktopFolder.."\\IPT\\Offices\\"..new_company_re sult);

    Originally posted by Bruce
    I would like to rename a folder from a string that comes from a input called new_company_result. I'm forgeting something here.

    Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\New Company", _DesktopFolder.."\\IPT\\Offices\\new_company_result");

    Comment

    • Intrigued
      Indigo Rose Customer
      • Dec 2003
      • 6138

      #3
      I created the folder(s) and tried your code Bruce and it works for me (no adjustments needed).
      Intrigued

      Comment

      • Worm
        Indigo Rose Customer
        • Jul 2002
        • 3971

        #4
        I think the new folder is the result of a Dialog.Input, therefore the resulting variable needs to be concatenated to the path.

        Originally posted by Intrigued
        I created the folder(s) and tried your code Bruce and it works for me (no adjustments needed).

        Comment

        • Bruce
          Indigo Rose Customer
          • Jun 2001
          • 2134

          #5
          Apparently the folder is still being used by AMS and will not allow the name change...Any Ideas?

          You know what, I should kill two birds here. I am really doing two renames from two inputs:

          new_company_result = Input.GetText("new company Input");
          realtors_name_result = Input.GetText("realtors_name_Input");
          Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\New Company", _DesktopFolder.."\\IPT\\Offices\\"..new_company_re sult);
          Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\new _company_result\\New Realtor, _DesktopFolder..\\IPT\\Offices\\New Company\\"..realtors_name_result);

          I'm not sure this is the way to go.
          Last edited by Bruce; 06-27-2005, 11:47 AM.

          Comment

          • rhosk
            Indigo Rose Customer
            • Aug 2003
            • 1698

            #6
            Without seeing some more of your code, it would be hard to determine the problem. Have you tried Folder.SetCurrent? This would take AMS away from the [problem] folder.
            Regards,

            -Ron

            Music | Video | Pictures

            Comment

            • Intrigued
              Indigo Rose Customer
              • Dec 2003
              • 6138

              #7
              Originally posted by Worm
              I think the new folder is the result of a Dialog.Input, therefore the resulting variable needs to be concatenated to the path.
              Ah, presumtions... dangerous path ... to the darkside they are!



              (good thinking nontheless)
              Intrigued

              Comment

              • Bruce
                Indigo Rose Customer
                • Jun 2001
                • 2134

                #8
                I think the new folder is the result of a Dialog.Input, therefore the resulting variable needs to be concatenated to the path.

                Comment

                • rhosk
                  Indigo Rose Customer
                  • Aug 2003
                  • 1698

                  #9
                  Maybe an Application.Sleep in between the Renames - give it time for the rename to occur? You're also missing some quotes in thar!

                  new_company_result = Input.GetText("new company Input");
                  realtors_name_result = Input.GetText("realtors_name_Input");
                  Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\New Company", _DesktopFolder.."\\IPT\\Offices\\"..new_company_re sult);
                  Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\new _company_result\\New Realtor", _DesktopFolder.."\\IPT\\Offices\\New Company\\"..realtors_name_result);

                  I would avoid spaces if at all possible. They can be a pain in the *** sometimes, personal preference.
                  Regards,

                  -Ron

                  Music | Video | Pictures

                  Comment

                  • Intrigued
                    Indigo Rose Customer
                    • Dec 2003
                    • 6138

                    #10
                    Ah, it may be that Worm was far more the Jedi than I had assumed! (assumed, dang the assumptions, SEE! ). By using an Input object to get a path... that would thus be a variable and then the use of concantenation ("..") would be needed.

                    Worm'nator strikes back!

                    Intrigued

                    Comment

                    • Bruce
                      Indigo Rose Customer
                      • Jun 2001
                      • 2134

                      #11
                      rhosk- thanks
                      Without seeing some more of your code, it would be hard to determine the problem. Have you tried Folder.SetCurrent? This would take AMS away from the [problem] folder.
                      I tried that. I can even go to that folder and try changing it and the system wont let me.

                      Comment

                      • rhosk
                        Indigo Rose Customer
                        • Aug 2003
                        • 1698

                        #12
                        Is this only when you're "previewing" the app (system won't let you change it)?

                        If not,

                        Reboot

                        I've found that on XP machines, sometimes this happens - weird. For ex; I'll delete a folder, the system still thinks it's there, try to access, denied. Then several minutes later, the folder is gone, but rebooting eliminates it every time.

                        Also look to see if something's hanging in your task manager. HTH
                        Regards,

                        -Ron

                        Music | Video | Pictures

                        Comment

                        • Bruce
                          Indigo Rose Customer
                          • Jun 2001
                          • 2134

                          #13
                          This only happens during preview, once I kill the preview I can then rename the folder.

                          Comment

                          • Intrigued
                            Indigo Rose Customer
                            • Dec 2003
                            • 6138

                            #14
                            Originally posted by Bruce
                            This only happens during preview, once I kill the preview I can then rename the folder.
                            Have you tried after you have Built (F7) the project and not just F5 (Previewed) it?
                            Intrigued

                            Comment

                            • rhosk
                              Indigo Rose Customer
                              • Aug 2003
                              • 1698

                              #15
                              Bruce, looking at your code more closely, this line -

                              Folder.Rename(_DesktopFolder.."\\IPT\\Offices\\new_company_result\\New Realtor", _DesktopFolder.."\\IPT\\Offices\\New Company\\"..realtors_name_result);

                              This folder (in red) obviously doesn't exist yet. And the string variable (in blue) isn't formatted correctly.

                              Why don't we start from scratch. What is your goal here?

                              Edit -- In addition, the folder (in green) has just been renamed with the line above
                              Last edited by rhosk; 06-27-2005, 01:52 PM.
                              Regards,

                              -Ron

                              Music | Video | Pictures

                              Comment

                              Working...
                              X