-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?

1
  • There may be a duplicate Q out there, but the currently-linked one doesn't have answers for this question. Commented Jul 18, 2017 at 20:21

2 Answers 2

2

With simple find + mv command:

find yourfolder/ -type f -exec mv {} {}".txt" \; 
1
  • yes, works .... Commented Jul 18, 2017 at 17:20
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' \; 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.