Command to rename file extensions on a server?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chodadog
    Confirmed User
    • Apr 2002
    • 9736

    #1

    Command to rename file extensions on a server?

    I need to change .JPG to .jpg in a particular folder. Needs to do subfolders too. Thanks.
    26 + 6 = 1
  • broke
    Confirmed User
    • Aug 2003
    • 4501

    #2
    What OS?
    Perfect Gonzo

    Comment

    • keyDet79
      Confirmed User
      • Feb 2003
      • 1109

      #3
      mv in nix, ren in win

      Multihomed quality BW for less
      ICQ 51034232 - MSN [email protected] - Email keydet(at)vibehosting.com

      Comment

      • chodadog
        Confirmed User
        • Apr 2002
        • 9736

        #4
        Hrm. I don't even know. It's not my server. Uploading something for a client. Didn't notice that the file extensions were wrong (windows not being case sensitive and all). I shall find out.
        26 + 6 = 1

        Comment

        • com
          Confirmed User
          • Aug 2003
          • 4541

          #5
          execute:

          cd /path/to/folder; ls -al | grep JPG | awk '{print $9, $9}' >shit && vi shit

          in vi hit escape, delete the top two lines (should be "." and "..", these can be deleted by hitting "d" twice, followed by shift-colon, at the colon prompt enter this sequence:

          %s/^/mv /g

          enter after that, simply change the second colum to have lower case jpg at the end. escape back to shell and save by hitting escape shift-colon and at the prompt enter:

          wq!

          at the prompt execute:

          sh shit

          I would explain how to do it for all files etc... but that's getting a bit tricky and wouldnt want to do so without seeing the file structure myself. be careful!

          Real. Professional. Hosting.
          .:Expect Nothing Less:.
          320-078-843 :: www.realprohosting.com :: [email protected]

          Comment

          • Weppel
            Confirmed User
            • Aug 2003
            • 2190

            #6
            Could be done by a simple shellscript, or a php script, whatever you want ;)

            Comment

            • chodadog
              Confirmed User
              • Apr 2002
              • 9736

              #7
              Ooh. if it can be done with a php script, that would be great. Could someone be so kind as to give me the code? Thanks.
              26 + 6 = 1

              Comment

              • directfiesta
                Too lazy to set a custom title
                • Oct 2002
                • 30157

                #8
                Why dont you just delete the files you uploaded. Then, on your pc, do a batch rename of the extension with Namewiz or any other renaming proggie. Then re-upload the shit.

                Much safer than going in " shell" by telnet....

                Or if not too many, use an FTP like shell manager:

                F-Securee SSH file transfer. If interested, could post the link...
                I know that Asspimple is stoopid ... As he says, it is a FACT !

                But I can't figure out how he can breathe or type , at the same time ....

                Comment

                • com
                  Confirmed User
                  • Aug 2003
                  • 4541

                  #9
                  regular expressions own!
                  I've always wished that this was syntactically correct:

                  # mv *.WHATEVER *.whatever

                  hehe

                  Real. Professional. Hosting.
                  .:Expect Nothing Less:.
                  320-078-843 :: www.realprohosting.com :: [email protected]

                  Comment

                  • blazin
                    Confirmed User
                    • Aug 2002
                    • 2781

                    #10
                    Originally posted by com
                    execute:

                    cd /path/to/folder; ls -al | grep JPG | awk '{print $9, $9}' >shit && vi shit

                    in vi hit escape, delete the top two lines (should be "." and "..", these can be deleted by hitting "d" twice, followed by shift-colon, at the colon prompt enter this sequence:

                    %s/^/mv /g

                    enter after that, simply change the second colum to have lower case jpg at the end. escape back to shell and save by hitting escape shift-colon and at the prompt enter:

                    wq!

                    at the prompt execute:

                    sh shit

                    I would explain how to do it for all files etc... but that's getting a bit tricky and wouldnt want to do so without seeing the file structure myself. be careful!
                    Nice sledgehammer for a little nut
                    I don't endorse a god damn thing......

                    Comment

                    • chodadog
                      Confirmed User
                      • Apr 2002
                      • 9736

                      #11
                      Originally posted by directfiesta
                      Why dont you just delete the files you uploaded. Then, on your pc, do a batch rename of the extension with Namewiz or any other renaming proggie. Then re-upload the shit.

                      Much safer than going in " shell" by telnet....

                      Or if not too many, use an FTP like shell manager:

                      F-Securee SSH file transfer. If interested, could post the link...
                      Just didn't want to have to re-upload everrrrrrrrrything. But i just realised my FTP program has a setting that will only upload the new files. ooh. Thanks for the help anyways.
                      26 + 6 = 1

                      Comment

                      • com
                        Confirmed User
                        • Aug 2003
                        • 4541

                        #12
                        Originally posted by blazin


                        Nice sledgehammer for a little nut
                        depends on how you look at it... for me unix power tools are second nature... takes me less then a minute to accomplish what I need. How would you go about it

                        Real. Professional. Hosting.
                        .:Expect Nothing Less:.
                        320-078-843 :: www.realprohosting.com :: [email protected]

                        Comment

                        Working...