Question about file indexing

I have a problem. I need to run mdls -name kMDItemNumberOfPages on files that I copy to the desktop from a windows server (that I cannot index). Is there a way to script the indexing of a desktop folder? I don’t want to wait for the system to do this not knowing how long it takes.


Reading the man page mdimport(1) (man mdimport in a terminal window) the process without any parameters should start immediately.

set pxPath to (POSIX path of (path to desktop folder)) & "path to folder "
do shell script "mdimport " & quoted form of pxPath