Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Using Unix 'mdfind' and spaces in names different from old 'find' syntax, but how?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Using Unix 'mdfind' and spaces in names different from old 'find' syntax, but how?
Authored by: meckardt on May 09, '05 10:36:47AM
Okay here is the Script, which does not work because of the spaces in filenames and paths:

for i in `mdfind "kMDItemKind=='*Adobe Photoshop file*' && kMDItemColorSpace =='*CMYK*' && kMDItemResolutionWidthDPI > '72'"`

do
cp $i /Users/meckardt/Desktop/
done
 
Result:
cp: Tiger: No such file or directory
cp: 2005/3908497213.psd: No such file or directory
cp: /Volumes/Macintosh: No such file or directory

I know it must be possible, but how? I am totally stuck. How am I supposed to write a script with mdfind and use the results for cp or mv? The pathnames do have a lot Spaces and mdfind & xargs do not behave the same as find & xargs did before.

Thanks, Matt

[ Reply to This | # ]

10.4: Using Unix 'mdfind' and spaces in names different from old 'find' syntax, but how?
Authored by: huzzam on May 10, '05 04:06:34AM

Try putting double quotes around the $i, thus:

cp "$i" /Users/meckardt/Desktop/



[ Reply to This | # ]