Rename all files in directory through terminal [duplicate]












0
















This question already has an answer here:




  • Renaming hundreds of files at once for proper sorting

    6 answers




Say, I have several files in a directory.



How do I rename all of them to "001", "002", etc., saving their current file extensions?










share|improve this question







New contributor




user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by pa4080, pomsky, user68186, karel, Kulfy 5 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    0
















    This question already has an answer here:




    • Renaming hundreds of files at once for proper sorting

      6 answers




    Say, I have several files in a directory.



    How do I rename all of them to "001", "002", etc., saving their current file extensions?










    share|improve this question







    New contributor




    user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.











    marked as duplicate by pa4080, pomsky, user68186, karel, Kulfy 5 hours ago


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0









      This question already has an answer here:




      • Renaming hundreds of files at once for proper sorting

        6 answers




      Say, I have several files in a directory.



      How do I rename all of them to "001", "002", etc., saving their current file extensions?










      share|improve this question







      New contributor




      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.













      This question already has an answer here:




      • Renaming hundreds of files at once for proper sorting

        6 answers




      Say, I have several files in a directory.



      How do I rename all of them to "001", "002", etc., saving their current file extensions?





      This question already has an answer here:




      • Renaming hundreds of files at once for proper sorting

        6 answers








      rename batch-rename






      share|improve this question







      New contributor




      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 12 hours ago









      user3379275user3379275

      1




      1




      New contributor




      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user3379275 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      marked as duplicate by pa4080, pomsky, user68186, karel, Kulfy 5 hours ago


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by pa4080, pomsky, user68186, karel, Kulfy 5 hours ago


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          1 Answer
          1






          active

          oldest

          votes


















          5
















          • Terminal method
            cd (change directory) to the folder.

            run command:



            a=1; for i in *.*; do new=$(printf "%03d" "$a"); mv -i -- "$i" "$new.${i##*.}"; let a=a+1; done


          • GUI method

            Select all files to be renamed.

            Right click and select rename.

            Delete [Original file name] from the option area.
            Click on "Add" and select 001, 002, 003, 004.

            Click on "Rename".



          rename-1



          rename-2



          enter image description here






          share|improve this answer


























          • Will try tomorrow. Sleepy. It's is late here.

            – VeeJay
            10 hours ago






          • 1





            seems like a lot of work when there are multiple 'rename' commands available.

            – rtaft
            9 hours ago











          • @user68186 edited command-line for use "...through terminal"

            – VeeJay
            8 hours ago


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5
















          • Terminal method
            cd (change directory) to the folder.

            run command:



            a=1; for i in *.*; do new=$(printf "%03d" "$a"); mv -i -- "$i" "$new.${i##*.}"; let a=a+1; done


          • GUI method

            Select all files to be renamed.

            Right click and select rename.

            Delete [Original file name] from the option area.
            Click on "Add" and select 001, 002, 003, 004.

            Click on "Rename".



          rename-1



          rename-2



          enter image description here






          share|improve this answer


























          • Will try tomorrow. Sleepy. It's is late here.

            – VeeJay
            10 hours ago






          • 1





            seems like a lot of work when there are multiple 'rename' commands available.

            – rtaft
            9 hours ago











          • @user68186 edited command-line for use "...through terminal"

            – VeeJay
            8 hours ago
















          5
















          • Terminal method
            cd (change directory) to the folder.

            run command:



            a=1; for i in *.*; do new=$(printf "%03d" "$a"); mv -i -- "$i" "$new.${i##*.}"; let a=a+1; done


          • GUI method

            Select all files to be renamed.

            Right click and select rename.

            Delete [Original file name] from the option area.
            Click on "Add" and select 001, 002, 003, 004.

            Click on "Rename".



          rename-1



          rename-2



          enter image description here






          share|improve this answer


























          • Will try tomorrow. Sleepy. It's is late here.

            – VeeJay
            10 hours ago






          • 1





            seems like a lot of work when there are multiple 'rename' commands available.

            – rtaft
            9 hours ago











          • @user68186 edited command-line for use "...through terminal"

            – VeeJay
            8 hours ago














          5












          5








          5









          • Terminal method
            cd (change directory) to the folder.

            run command:



            a=1; for i in *.*; do new=$(printf "%03d" "$a"); mv -i -- "$i" "$new.${i##*.}"; let a=a+1; done


          • GUI method

            Select all files to be renamed.

            Right click and select rename.

            Delete [Original file name] from the option area.
            Click on "Add" and select 001, 002, 003, 004.

            Click on "Rename".



          rename-1



          rename-2



          enter image description here






          share|improve this answer

















          • Terminal method
            cd (change directory) to the folder.

            run command:



            a=1; for i in *.*; do new=$(printf "%03d" "$a"); mv -i -- "$i" "$new.${i##*.}"; let a=a+1; done


          • GUI method

            Select all files to be renamed.

            Right click and select rename.

            Delete [Original file name] from the option area.
            Click on "Add" and select 001, 002, 003, 004.

            Click on "Rename".



          rename-1



          rename-2



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 8 hours ago

























          answered 12 hours ago









          VeeJayVeeJay

          1,7611720




          1,7611720













          • Will try tomorrow. Sleepy. It's is late here.

            – VeeJay
            10 hours ago






          • 1





            seems like a lot of work when there are multiple 'rename' commands available.

            – rtaft
            9 hours ago











          • @user68186 edited command-line for use "...through terminal"

            – VeeJay
            8 hours ago



















          • Will try tomorrow. Sleepy. It's is late here.

            – VeeJay
            10 hours ago






          • 1





            seems like a lot of work when there are multiple 'rename' commands available.

            – rtaft
            9 hours ago











          • @user68186 edited command-line for use "...through terminal"

            – VeeJay
            8 hours ago

















          Will try tomorrow. Sleepy. It's is late here.

          – VeeJay
          10 hours ago





          Will try tomorrow. Sleepy. It's is late here.

          – VeeJay
          10 hours ago




          1




          1





          seems like a lot of work when there are multiple 'rename' commands available.

          – rtaft
          9 hours ago





          seems like a lot of work when there are multiple 'rename' commands available.

          – rtaft
          9 hours ago













          @user68186 edited command-line for use "...through terminal"

          – VeeJay
          8 hours ago





          @user68186 edited command-line for use "...through terminal"

          – VeeJay
          8 hours ago



          Popular posts from this blog

          How did Captain America manage to do this?

          迪纳利

          南乌拉尔铁路局