Based on the clarifications in the comments, you can do the following:
Create an index file
find /Volumes/YOUR-EXTERNAL-DRIVE -print > ~/YOUR-EXTERNAL-DRIVE-index.txt
This will list all files/folders on the external drive and store the result in your home folder.
Search for a file
grep THE-NAME-YOU-ARE-LOOKING-FOR ~/YOUR-EXTERNAL-DRIVE-index.txt
Partial names will work as well (and the external drive must not be attached for the search).
For reading a text file of hostnames into an AppleScript list, see Read textfile into list in Applescript.
For looping over hostnames within your AppleScript list see An AppleScript list iterate/loop example:
set myList to {"Hello", "Goodbye", "I must be going"}
repeat with theItem in myList
say theItem
end repeat
do shell script
To avoid launching Terminal.app, use the do shell script command:
tell machine "eppc://<ip address of remote machine>"
do shell script "system_profiler -detailLevel full > /tmp/sysprofile.txt"
end tell
This can be run without launching a supporting graphical application.
I am assuming you can not access the remote host via secure shell, only via Remote AppleEvent access eppc
.
Returning the File
Read the contents of the file within your AppleScript's tell machine
block and save it locally outside of the tell machine
block.
Alternatively, have you considered transferring back the system profile file via ssh
or scp
? Consider having your AppleScript to connect to your Mac and copy back the collected system profile.
Best Answer
If a shell script solution is acceptable as well, try the following
This of course only works for this specific XML example and requires all files to be in jpg format.