How can I combine this shell for files?

I’ve written the code below and would like to add in the primary to return regular files. After changing it several times, no rearrangement (or addition of the quoted form) has been workable. I’d appreciate a pointer.

[i]This is the current, working syntax–>/i+(lexicographical)+(exclude name ending with)

[i]This is desired–>/i+(regular files)+(lexicographical)+(exclude name ending with)

do shell script "find -f" & space & (((path to desktop) as text)'s POSIX path) & space & ("-s") & space & ("! -name *.pdf")

–edited for misspelling


The basic form of find is find directory -name, and don’t challenge that. What I think was a problem with yours, was that you hadn’t quoted the star, so it was interpreted by the shell. I added -type f at the end of your command, thinking all of this interpreted, and set up before find executes anyway.

do shell script "find -f" & space & (((path to desktop) as text)'s POSIX path) & space & ("-s") & space & ("! -name '*.pdf' -type f")

:smiley: I have to clean up my desktop!

Hi, McUsr. Thank you for your help. That appears to have been the problem. I mistakenly tried applying the quoted form to that segment, rather than just the wildcarded part.

This is more of a curiosity, rather than an actual problem”since I’m looking for files”but, in testing your advice, I toggled the type to directories (d); that sort of worked, with the exception of two rich text files inexplicably showing up in the result among hundreds of what was otherwise only directories. Weird.

Hello Marc.

I think the explanation is that the rtfd files, are indeed bundles, unix commands can’t tell the difference between folders and bundles.