Search code examples
linuxcsh

how to append a string to multiple files in linux


I have a folder containing multiple files such as

  • file1
  • myfile
  • thisbogusfile
  • anotherfile

I would like to append the string .txt at the end of every file. How can I do that with the command line?

Thanks!


Solution

  • You mean you want to rename the files

    foreach i (*)
       mv "$i" "$i.txt"
    end