Hi

On OSX this is easy to do-something like this should work

$_t_DocumentPath:=<—known name  //if a partialthe image path is know
$_txt_OSASCRIPT:="mdfind "+Char(34)+$_t_DocumentPath+Char(34)
$_t_InputStream:=""
$_t_OutputStream:=""
LAUNCH EXTERNAL PROCESS($_txt_OSASCRIPT;$_t_InputStream;$_t_OutputStream)




> On 16 May 2017, at 07:59, John Baughman via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I am thinking that perhaps using Launch External Process there might be a way 
> to search for a file and get back the path to the file if found.
> 
> I have a method that recursively crawls through a volume or folder to locate 
> a file, but it is relatively slow. It is pasted below. Any ideas to make this 
> more efficient or know how to use LEP to do a file search. Needs to work on 
> both Mac and Windows.
> 
> Thanks,
> 
> John
> 
> //Method: SearchFolderContents_Jut
> C_TEXT($1;$folderPath;$2;$documentToFind;$0;$pathToDocumentFound)
> $folderPath:=$1
> $documentToFind:=$2
> $pathToDocumentFound:=""
> 
> DOCUMENT LIST($folderPath;$aDocuments)
> $found:=Count in array($aDocuments;$documentToFind)
> 
> If ($found>0)
>          $pathToDocumentFound:=$folderPath+$documentToFind
>       
> End if 
> 
> If ($pathToDocumentFound="")
>        FOLDER LIST($folderPath;$aFolders)
>       
>        For ($i;1;Size of array($aFolders))
>                $pathToDocumentFound:=SearchFolderContents_Jut 
> ($folderPath+$aFolders{$i}+Folder separator;$documentToFind)
>                If ($pathToDocumentFound#"")
>                        $i:=Size of array($aFolders)+10
>                       
>                End if 
>               
>         End for 
>       
> End if 
> 
> $0:=$pathToDocumentFound
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to