Advertisement
pebriana

rename multiple file

Jun 20th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. foo001.a
  2. foo002.a
  3. foo003.a
  4. foo004.a
  5. foo005.a
  6.  
  7.  
  8. #rename ‘s/foo/bar/’ foo*.a
  9. #ls
  10. ------result
  11. bar001.a
  12. bar002.a
  13. bar003.a
  14. bar004.a
  15. bar005.a
  16.  
  17.  
  18. -----------
  19.  
  20.  
  21. To remove .jpg file extension, you write command as follows:
  22.  
  23. $ rename 's/\.jpg$//' *.jpg
  24.  
  25. To convert all uppercase filenames to lowercase:
  26.  
  27. $ rename 'y/A-Z/a-z/' *
  28.  
  29. Read the man page of rename command for more information:
  30. man rename
  31.  
  32.  
  33. other :
  34. rename space to _
  35.  
  36. for file in *;do mv $file ${file// /_};done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement