Add an Extension to All Files in a Directory


2018-12-09

To add an extension to all of the files in a directory using bash (Linux or Mac OS terminal), try this:

for file in *; do if [ -f ${file} ]; then mv ${file} ${file}.md; fi; done;

That command will add '.md' to all the files in that directory.