views:

57

answers:

1

The following UNIX one-liner looks for Python files below the CWD and adds them to a TAGS file for Emacs (or we could do the same with Ctags).

find . -name *.py -print | xargs etags

This breaks if the CWD has a space or other unusual character in its name. -print0 or -ls don't seem to help, in spite of what man find says. Is there a neat way around this?

+2  A: 
find . -name '*.py' -print0 | xargs -0 etags

should do the trick -- you need the -0 arg to xargs to match the -print0 properly.

edit

you probably need the quotes around *.py as well, if there are any .py files in the current directory.

Chris Dodd
Thanks @Chris, and you were quite right about the quotes. D'OH!
snim2