mdfind
mdfind(1) Mac OS X Manual Page
SYNOPSIS mdfind [-live] [-count] [-onlyin directory] [-name fileName] query -onlyin dir Limit the scope of the search to the directory specified. -name fileName Searches for matching file names only.\ -0 Prints an ASCII NUL character after each result path. This is useful when used in conjunction with xargs -0. mdfind javascript mdfind -onlyin ~/Dropbox/ebook -name javascript
via: 5 Unix Commands I Wish I’d Discovered Years Earlier
This one is specific to mac, as there are other *nix equivalents. It has similar functionality to find but uses the Spotlight index. It allows you to search your entire filesystem in seconds. You can also use it to give you live updates when new files that match your query appear. I use it most often when I’m trying to find the obscure location that an application stores some critical file.如果是用findmdfind -onlyin . -name url -0 | xargs -0 rm mdfind -onlyin . -name url -0 | xargs -0 -J % rm -rf % mdfind -onlyin . -name url -0 | xargs -0 -J % cp % /tmp // -J % 可以把 % 當做送進來的參數
find . -type f -name *.js -print0 | xargs -0 rm
沒有留言:
張貼留言