-1

I have a folder containing 500 files like this:

 xaa
 xab
 xac
 xad
 aae
 aaf

I want to add ".txt" to the end of all of them to get something like this:

xaa.txt
xab.txt
xac.txt
xad.txt

How would this be done?

Anna1364
  • 1,026

2 Answers2

2

With simple find + mv command:

find yourfolder/ -type f -exec mv {} {}".txt" \;
0

There are several ways. Here are three:

rename 's/$/.txt/' ???    # Might be prename on some systems

for f in ???; do mv "$f" "$f.txt"; done

find -maxdepth 1 -type f -exec mv {} '{}.txt' \;
Chris Davies
  • 116,213
  • 16
  • 160
  • 287