Wednesday, May 1, 2019

Add Prefix to File Names

Here's how to add a prefix, e.g., "uhu-" to all file names in the current directory:

Original List of Files


$ ll
total 20
drwxr-xr-x  2 lex lex 4096 May  1 09:46 ./
drwxr-xr-x 22 lex lex 4096 May  1 09:45 ../
-rwxr-xr-x  1 lex lex  284 May  1 09:46 drop-tables*
-rwxr-xr-x  1 lex lex   45 May  1 09:44 drop-tables-gen-and-seed*
-rwxr-xr-x  1 lex lex  943 May  1 09:46 gen-tables-and-seed*


Run Bash Commands to Rename Files


$ find . -type f | while read line; do   mv "$line" "uhu-${line:2:999}"; done

$ ll
total 20
drwxr-xr-x  2 lex lex 4096 May  1 09:51 ./
drwxr-xr-x 22 lex lex 4096 May  1 09:45 ../
-rwxr-xr-x  1 lex lex  284 May  1 09:46 uhu-drop-tables*
-rwxr-xr-x  1 lex lex   45 May  1 09:44 uhu-drop-tables-gen-and-seed*
-rwxr-xr-x  1 lex lex  943 May  1 09:46 uhu-gen-tables-and-seed*


Note


alias ll='ls -alF'


This work is licensed under the Creative Commons Attribution 3.0 Unported License.

10 comments:

  1. Really nice information you provided here. Am much impressed and please keep update like this.

    Blockchain Development Services

    Product Development Services

    Google Analytics Consulting Services

    ReplyDelete
  2. Domino yaitu seperti permainan kartu yang generik. di indonesia sudah banyak yang tahu kartu perihal yang demikian serta sering sekali di mainkan
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terpercaya
    hobiqq
    paito warna oregon
    syair hk
    datahk

    ReplyDelete
  3. Good blog it is very useful
    Sanjary Kids is one of the best play school and preschool in Hyderabad,India. Give your child the best preschool experience by choosing the best playschool of Hyderabad in Abids. we provide programs like Play group,Nursery,Junior KG,Senior KG,and provides Teacher Training Program.
    Preschool teacher training course in hyderabad

    ReplyDelete
  4. Excellent blog posting information

    Sanjary Academy is the best Piping Design institute in Hyderabad, Telangana. It is the best Piping design Course in India and we have offer professional Engineering Courses like Piping design Course, QA/QC Course, document controller course, Pressure Vessel Design Course, Welding Inspector Course, Quality Management Course and Safety Officer Course.
    best Piping Design Course
    piping design course with placement
    Piping Design Course
    Piping Design Course in Hyderabad ­
    Piping Design Course in India­
    best Piping Design institute
    best institute of Piping Design Course in India

    ReplyDelete
  5. Thanks for sharing the updated informative and understandable

    Sanjary Academy provide pressure vessel design,quality management system course, piping design course, qa/qc course and document controller course.
    Welding Inspector Course
    Safety officer course
    Quality Management Course
    Quality Management Course in India

    ReplyDelete
  6. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you.

    aws solutions architect certification

    ReplyDelete
  7. Thank you for taking the time to publish this information very useful!

    aws course

    ReplyDelete
  8. Your website is really cool and this is a great inspiring article.

    business analysis certification

    ReplyDelete