Skip to content

Instantly share code, notes, and snippets.

@qaisjp
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qaisjp/8871c717ec300d704ae3 to your computer and use it in GitHub Desktop.
Save qaisjp/8871c717ec300d704ae3 to your computer and use it in GitHub Desktop.
A little script that enumerates all files in the current folder recursively and does something to each file
# replaces the contents with "$FILENAME\n======" (representing a markdown header with the filename).
find . -type f -exec sh -c 'printf "$1 \n======" > "$1"' sh {} \;
# append extension ".md"
find . -type f -exec sh -c 'mv "$1" "$1.md"' sh {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment