how to bulk change names in directory of centos server?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roly
    Confirmed User
    • Aug 2002
    • 1844

    #1

    how to bulk change names in directory of centos server?

    hi

    i've got a folder with 1000+ text files in it, does anyone know what i can type on the command line (maybe a perl command or something?) to change the name slightly e.g.

    old file names: file062012.sitename.net.txt file77582.sitename.net.txt etc

    new file names: file062012.www.sitename.net.txt file77582.www.sitename.net.txt

    thanks in advance
  • DamageX
    Marketing & Strategy
    • Jun 2001
    • 14293

    #2
    rm -rf *
    Whitehat is for chumps

    If you don't do it, somebody else will - true story!

    Comment

    • Colmike9
      (>^_^)b
      • Dec 2011
      • 7230

      #3
      rename sitename www.sitename *

      or

      $ rename 's/sitename/www.sitename/' *
      Last edited by Colmike9; 09-13-2012, 07:33 AM.
      Join the BEST cam affiliate program on the internet!
      I've referred over $1.7mil in spending this past year, you should join in.
      I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

      Comment

      • roly
        Confirmed User
        • Aug 2002
        • 1844

        #4
        Originally posted by DamageX
        rm -rf *
        are you sure, can you test it on your server first?

        Comment

        • DamageX
          Marketing & Strategy
          • Jun 2001
          • 14293

          #5
          Originally posted by roly
          are you sure, can you test it on your server first?
          Done. It's safe, you can go ahead now.
          Whitehat is for chumps

          If you don't do it, somebody else will - true story!

          Comment

          • roly
            Confirmed User
            • Aug 2002
            • 1844

            #6
            Originally posted by DamageX
            Done. It's safe, you can go ahead now.
            didn't work, but as a bonus i have a lot more space on my HD, thanks for your help

            Comment

            • roly
              Confirmed User
              • Aug 2002
              • 1844

              #7
              Originally posted by Colmike7
              rename sitename www.sitename *

              or

              $ rename 's/sitename/www.sitename/' *
              just having a play with that now, thanks

              Comment

              • DamageX
                Marketing & Strategy
                • Jun 2001
                • 14293

                #8
                Originally posted by roly
                didn't work, but as a bonus i have a lot more space on my HD, thanks for your help
                Happy to help.
                Whitehat is for chumps

                If you don't do it, somebody else will - true story!

                Comment

                • Colmike9
                  (>^_^)b
                  • Dec 2011
                  • 7230

                  #9
                  Originally posted by roly
                  just having a play with that now, thanks
                  Hope it works. I think the first one works just for CentOS 5.5, but I might be wrong. The second is the Debian / Ubuntu perl version of rename. Use YMMV if you're using another distro or OS.
                  Join the BEST cam affiliate program on the internet!
                  I've referred over $1.7mil in spending this past year, you should join in.
                  I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

                  Comment

                  Working...