0

I have a folder containing number of files with extensions in .xvg format and i need to change them into .dat format. How can i do that..?

What are the commands that i need to give such that all those files extensions that are in .xvg format are converted into .dat format [without the file name getting changed,(example., abc.xvg should be converted into abc.dat),only file extension should be changed].

D.H.N
  • 69
  • 1
  • 9
  • 3
    Possible duplicate of [Change file extensions of multiple files in a directory with terminal/bash?](https://stackoverflow.com/questions/8551993/change-file-extensions-of-multiple-files-in-a-directory-with-terminal-bash) – Will Barnwell Jul 12 '17 at 17:34

1 Answers1

0

Try this

rename 's/.xvg$/.dat/' *.xvg

For a test run you can use this command:

rename 's/.xvg$/.dat/' *.xvg -vn

-v means "verbose" and it will output the names of the files when it renames them.

-n will do a test run where it won't rename any files, But will show you a list of files that would be renamed.

Croaton
  • 1,812
  • 3
  • 18
  • 28