Rename files in terminal


Recommended Posts

 

 

Hi guys!

I have a problem with terminal I would like to solve. 
I use a program that creates a file like this: "20134abcd.bvec" the name is random, but it starts with "20" every time, because of the date it was originally created is after 2000.

I want to incorporate a line into my bash script that renames "20134abcd.bvec" to only "bvecs" without extension.

How can I do this as this does not work "mv 20*.bvec bvecs"?

Thanks!?
Link to comment
Share on other sites

If there's only one file, you can do something like this (although "mv 20*.bvec bvecs" does work for me, though):

 

mv $(ls 20*.bvec) bvecs

 

For several files you'd have to iterate through them with a "for i in *.bvec" kind of loop.

Link to comment
Share on other sites

  • 3 weeks later...
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.