You can also do this with AppleScript.
The script below open recursively all files/folder dropped on it.
For each files, execute the PHP script defined by phpScriptPath passing the file path as argument.
To create the application :
1. Open AppleScript Editor
2. Paste following code:
property phpScriptPath : "/myPHP\ Scripts/my_script.php" -- Absolute path to your PHP script
on open droppedItems
repeat with theItem in theItems
if isDirectory(theItem) then
do shell script phpScriptPath & " " & quoted form of (POSIX path of (theItem as alias))
-- This function comes from here :
on isDirectory(someItem) -- someItem is a file reference
set filePosixPath to quoted form of (POSIX path of (someItem as alias))
set fileType to (do shell script "file -b " & filePosixPath)
if fileType ends with "directory" then return true
3. Set absolute path of the PHPscript
Edit the first property line of the script
4. Export as application
File menu > Export :
- Choose app name & destination
- Select to export as Application