Hi
Iv’e been trying to get a faster search of a external fire wire drive, tried using system events, and now want to try mdfind, iv’e never used it before so i’m learning how to implement it properly.
The code below works well on a local drive using the “mdfind -onlyin” command, but it does not work as expected on an external fire wire drive, no result returned. If how ever I remove the “-onlyin” command the code works as expected, but obviously the search takes longer because it is searching every where.
I have re-indexed the external drive and still no joy unless I remove the “-onlyin” command, am I missing something important?
set Filename to "98543-TEST"
set Fileext to "ps"
set GOgETiT to "mdfind -onlyin /RIP FILES/ 'kMDItemDisplayName == " & quote & Filename & "*" & quote & "wc" & " && (kMDItemFSName == " & quote & "*." & Fileext & quote & ")'"
do shell script GOgETiT
have you considered that local external drives are usually located in /Volumes
and RIP FILES must be escaped or quoted because of the containing space characters
no, not at all, i’m running reasonably blind as I fumble my way through learning how to use mdfind, your suggestion worked perfectly, the speed difference is huge from 30 seconds approx to 6 seconds approx, the search has to troll through 20.000 plus post script files
here is a quick lesson
¢ in a shell script paths must be ALWAYS escaped or quoted if they contain space characters, because spaces are regarded as parameter delimiter
¢ POSIX paths of external volumes start ALWAYS with /Volumes unless you specified the mounting points somewhere else (which is very very rare)