This question already has an answer here:

How to append “.backup” to the name of each file in your current directory?

marked as duplicate by terdon, Anthon, slm, Thomas Nyman, jasonwryan Feb 9 '14 at 17:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


If you have files with special characters and/or sub directories you should use:

find . -maxdepth 1 -type f -exec mv {} {}.backup \;

This can do the trick

for FILE in $(find . -type f) ; do mv $FILE ${FILE}.backup ; done
  • 2
    This would append to all files below the current directory not just to the ones in the current directory. – Joseph R. Feb 9 '14 at 10:55
  • 2
    Your answer only works if there are no spaces or newlines in the filenames. It also backs up all files in subdirectories of the current directory. – Timo Feb 9 '14 at 10:56
  • @Timo, space and newlines are not the only ones. tabs and all the wildcard characters (*, ?, [) are also a problem (except in zsh). – Stéphane Chazelas Feb 9 '14 at 16:03

With a POSIX shell:

for file in *;do
  [ -f "$file" ] && mv -- "$file" "$file.backup"

With perl's rename:

rename -- '-f && s/\Z/.backup/' *
  • * doesn't include file names that start with a dot. – jfs Feb 9 '14 at 11:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.