Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: how can i rename my current folder?  (Read 16823 times)

0 Members and 1 Guest are viewing this topic.

mioo_sara

    Topic Starter


    Intermediate

    how can i rename my current folder?
    « on: March 01, 2014, 07:15:11 AM »
    hi to all
    i want to rename my current folder (folder that i am in it) is it possible?
    with this script i can find my folder name but i cant rename it

    Quote
    for %%* in (.) do @echo %%~n*
    pause
    ren "%%~n*" "new"

    whats wrong?

    if its possible i want to remove any www.*.com from current folder name and replace it with space

    1- find current folder's name
    2-if there is any www. ???* .com in its name rename it(replace www. ???* .com )with space

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: how can i rename my current folder?
    « Reply #1 on: March 01, 2014, 07:53:51 AM »
    I don't think it can be done if the folder is in use,....
    " Anyone who goes to a psychiatrist should have his head examined. "

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: how can i rename my current folder?
    « Reply #2 on: March 01, 2014, 08:53:18 AM »
    patio is right.

    You have to cd out of the folder, rename it and cd back in.  This assumes that no tasks are open in the folder or tree, too.

    mioo_sara

      Topic Starter


      Intermediate

      Re: how can i rename my current folder?
      « Reply #3 on: March 01, 2014, 09:46:38 AM »
      Quote
      patio is right.

      You have to cd out of the folder, rename it and cd back in.  This assumes that no tasks are open in the folder or tree, too.

      ok  guess we stepped back one  level  now how  could  it  be  done?
      i  want  program to  do  this
      1- find  current folder's name
      2-  if  there is  www.??*.com  in  current folder's  name
      so step one  level  back and
      3- rename it(remove www.??*.com and  replace it  with space)
      4- create a text file  named password  and  write www.??*.com in it
      how should  i do  it?




      « Last Edit: March 01, 2014, 10:16:36 AM by mioo_sara »

      foxidrive



        Specialist
      • Thanked: 268
      • Experience: Experienced
      • OS: Windows 8
      Re: how can i rename my current folder?
      « Reply #4 on: March 01, 2014, 10:27:56 AM »
      Show us some examples of the actual folder name.

      The easiest method to use depends on the format of the folder name.

      Salmon Trout

      • Guest
      Re: how can i rename my current folder?
      « Reply #5 on: March 01, 2014, 12:20:53 PM »
      C:\Users\Me\testme>for /f "delims=" %N in ("%cd%") do cd.. & ren "%~dpnN" "newname" && cd "newname"

      C:\Users\Me\testme>cd..   & ren "C:\Users\Mike\testme" "newname"   && cd "newname"

      C:\Users\Me\newname>


      mioo_sara

        Topic Starter


        Intermediate

        Re: how can i rename my current folder?
        « Reply #6 on: March 01, 2014, 12:31:38 PM »
        Quote
        Show us some examples of the actual folder name.

        The easiest method to use depends on the format of the folder name.

        dear foxidrive
         i have  lots  of  folders most  of  them  containing  files (compressed password protested)
         folders have website's names  on  themselves
        example
        win_media.player.12(www.dowloadfree.com)include.patch
        format.factory(www.getfree.net)freeware


        1-i want websites name( in  folder names) removed and replaced  with  empty  space
        2- put website name  in  a file(password.text) and  save  it in that folder
        3- if  i am  in  the  current  folder  with  website's  name  you  know  what  to  do 
        i think  we should  step back  one  level  and  do  above  instructions
        these scripts  will  be  used  in  a third party  program  later
        thanks

        « Last Edit: March 01, 2014, 12:41:57 PM by mioo_sara »

        mioo_sara

          Topic Starter


          Intermediate

          Re: how can i rename my current folder?
          « Reply #7 on: March 01, 2014, 12:37:38 PM »
          dear Salmon Trout
          it didn't  worked just  created a for  and cd file  in  my  current  folder
          please read  my  last  2  post  above
          thanks

          Salmon Trout

          • Guest
          Re: how can i rename my current folder?
          « Reply #8 on: March 01, 2014, 01:16:22 PM »
          4- create a text file  named password  and  write www.??*.com in it

          This sounds interesting. What is it for?

          mioo_sara

            Topic Starter


            Intermediate

            Re: how can i rename my current folder?
            « Reply #9 on: March 01, 2014, 01:29:46 PM »
            passwords.text  will  be  a file  that  later  will  be  used  by  a third  party  program 
            theses batches  too :)
            now please  write for  8) me a batch

            patio

            • Moderator


            • Genius
            • Maud' Dib
            • Thanked: 1769
              • Yes
            • Experience: Beginner
            • OS: Windows 7
            Re: how can i rename my current folder?
            « Reply #10 on: March 01, 2014, 02:06:35 PM »
            Heeee...this should be good.
            " Anyone who goes to a psychiatrist should have his head examined. "

            Geek-9pm


              Mastermind
            • Geek After Dark
            • Thanked: 1026
              • Gekk9pm bnlog
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 10
            Re: how can i rename my current folder?
            « Reply #11 on: March 01, 2014, 02:48:52 PM »
            He lost me from the start.
            Windows assigns folders for each user.
            To rename the folder that has the user's name is a security and logical problem.
            {begin sarcasm}
            Imagine three user on a computer, Alice, Bib can  Carl.
            Alice wants to change her name to Carl, but still have her folder named Alice.
            So Carl must change his name, put still have his folder.
            Unable to resolve this they ask Bob.
            Bob does not want to help!

            What is the scrip that can handle that?

            {end sarcasm}

            Salmon Trout

            • Guest
            Re: how can i rename my current folder?
            « Reply #12 on: March 01, 2014, 04:51:03 PM »
            win_media.player.12(www.dowloadfree.com)include.patch
            format.factory(www.getfree.net)freeware


            .... and you thought we wouldn't check those sites out?

            Quote
            1-i want websites name( in  folder names) removed and replaced  with  empty  space

            I expect you do.

            Quote
            2- put website name  in  a file(password.text) and  save  it in that folder

            *censored*, we're just a bunch of stupid coders who don't care... we'll help you with passwords, freeware, (passworded freeware????) odd looking sites? Great!

            Quote
            i think  we should  step back  one  level

            Well, I'm stepping back several levels.

            Quote
            these scripts  will  be  used  in  a third party  program  later

            I have no doubt they will.



            BC_Programmer


              Mastermind
            • Typing is no substitute for thinking.
            • Thanked: 1140
              • Yes
              • Yes
              • BC-Programming.com
            • Certifications: List
            • Computer: Specs
            • Experience: Beginner
            • OS: Windows 11
            Re: how can i rename my current folder?
            « Reply #13 on: March 01, 2014, 05:53:09 PM »
            Quote
            compressed password protested
            methinks the password doth protest too much.
            I was trying to dereference Null Pointers before it was cool.

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: how can i rename my current folder?
            « Reply #14 on: March 01, 2014, 10:31:10 PM »
            win_media.player.12(www.dowloadfree.com)include.patch
            format.factory(www.getfree.net)freeware


            1-i want websites name( in  folder names) removed and replaced  with  empty  space

            How many spaces do you want left between the ( )?

            There could be issues with making a robust solution because the name format can be variable.  You could have names like this:

            win_media.player(type 2).12(www.dowloadfree.com)include.patch
            format.factory(www.getfree.net)freeware(supports Win2K)

            and the only way for a script to know which set of parentheses to work with is that in these two examples there is a www. after the opening (
            but it is possible that the website will not have a www. at the beginning of the URL.