Skip to content

Instantly share code, notes, and snippets.

@qaisjp

qaisjp/emptyfiles.sh

Last active Aug 29, 2015
Embed
What would you like to do?
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