Skip to content

Instantly share code, notes, and snippets.

@rafeco
Last active December 10, 2015 16:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafeco/4463514 to your computer and use it in GitHub Desktop.
Save rafeco/4463514 to your computer and use it in GitHub Desktop.
Generate tags files for all of the non-hidden directories under the current directory.
#!/bin/sh
start=$(pwd)
for f in $(find . \( ! -regex '.*/\..*' \) -type d); do
cd $f
ctags *
cd $start
done
ctags --file-scope=no -R
#!/bin/bash
start=$(pwd)
# Generate tags files in directories where "tags" is not the newest file
for f in $(find . -type f -newer ./tags); do
cd $f
ctags *
cd $start
done
# Generate tags files in directories with no tags files where the parent
# directory does have a tags file. Ignore hidden directories.
for f in $(find . -type d \( ! -regex '.*/\..*' \) \! -exec test -e '{}/tags' \; -print); do
if [ -e ${f}/../tags ]; then
cd $f
ctags *
cd $start
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment