Add an Extension to All Files in a Directory


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.