I still hate the handling of spaces – especially when you’re throwing in mixed path delimiters using nice GNU tools on DOS/NTFS.
If you ever want to get rid of SVN or CVS folders (or whatever) in a large source tree after someone has zipped it and sent it to you straight from their workspace, and Explorer’s Search window barfs with that many matching folders all over the place, then try this:
- Get unxutils
- Use the zsh included
- Realise zsh has bipolar tendancies when dealing with “DOS backslash to delimit directories in paths” and “UNIX slash to delimit directories in paths” and “UNIX backslash to quote special characters”
- Put unxutil’s usr/local/wbin at the front of your PATH (to get the GNU find, not the DOS one)
- Unfortunately -exec ls {} \; doesn’t do the trick because ls can’t handle the spaces and/or backslashes and -exec ls “{}” \; doesn’t have any affect
- Use the following neat trick (after 30 mins of mucking around with the bipolar tendancies)
- The little translate sorts out GNU find -print returning paths with backslashes and the while loop allows you to do lots of things, including removing the directory
find . -name 'CVS' -print | tr '\\' '/' | while read filename
do
rm -r "$filename"
done
It’s slower than -exec or xargs but it works.
Comments
Leave a comment Trackback