[X-Unix] Files Whose Names Begin With "."

James Bucanek subscriber at gloaming.com
Thu Nov 25 07:47:27 PST 2004


Ken Rossman wrote on Wednesday, November 24, 2004:

>Here's a way to recursively delete selected dot files (adjust the 
>patterns
>to suit your specific needs);
>
>   $ rm -r .[0-z]*

This won't recursively delete dot files.  This will recursively delete entire *subdirectories* that begin with a dot.  To wit: It would delete the entire subdirectory '.dir/', but leave any files in the subdirectory 'dir/' untouched.

Remember: the shell expands the wildcards, not the command.

To traverse a directory tree and delete all dot files in all subdirectories requires a command like this:

    find . -type f -name '.*' -print0 | xargs -0 rm

-- 
James Bucanek <mailto:privatereply at gloaming.com>


More information about the X-Unix mailing list