Create a new Applescript, paste this, and save it as an APP.
on run
set these_items to {} as list
set outputfolder to ""
set mlv2dng to (choose file with prompt "Choose the mlv2dng app") as string
set outputfolder to chooseoutputfolder(outputfolder)
set these_items to choosefilesbutton(these_items)
processfileselection(these_items, mlv2dng, outputfolder)
end run
on chooseoutputfolder(outputfolder)
set outputfolder to (choose folder with prompt "Select an output folder:") as list
repeat with i from 1 to (the count of (outputfolder as list))
set this_item to item i of (outputfolder as list)
set the item_info to info for (this_item)
if folder of the item_info is true then
set outputfolder to POSIX path of outputfolder
else
set outputfolder to POSIX path of (container of outputfolder)
end if
end repeat
return outputfolder
end chooseoutputfolder
on choosefilesbutton(these_items)
set these_items to (choose file with prompt "Choose a file or folder to process. Note: you can select any or all files; only the MVL files will be processed." with multiple selections allowed) as list
return these_items
end choosefilesbutton
on processfileselection(these_items, mlv2dng, outputfolder)
repeat with i from 1 to (the count of (these_items as list))
set this_item to item i of (these_items as list)
set the item_info to info for (this_item)
if folder of the item_info is true then
processfolder(this_item, mlv2dng, outputfolder)
else
processfile(this_item, mlv2dng, outputfolder)
end if
end repeat
end processfileselection
on processfolder(this_folder, mlv2dng, outputfolder)
set these_items to list folder (this_folder) without invisibles
repeat with i from 1 to (the count of (these_items as list))
set this_item to (((this_folder as Unicode text) & ((item i of these_items) as Unicode text)) as alias)
set the item_info to info for this_item
if folder of the item_info is true then
processfolder(this_item, mlv2dng, outputfolder)
else
processfile(this_item, mlv2dng, outputfolder)
end if
end repeat
end processfolder
on processfile(this_individual_item, mlv2dnglocation, outputfolder)
set validExtensions to {"MLV"}
set this_extension to "" as string
set AppleScript's text item delimiters to "."
tell application "Finder"
set n to name of file (this_individual_item)
if n contains "." then set this_extension to (text item -1 of n) as text
if n contains "." then set this_name to (text item -2 of n) as text
end tell
tell application "Finder"
end tell
if this_extension is in validExtensions then
tell application "System Events"
set thePath to POSIX path of (container of this_individual_item)
end tell
set myFile to POSIX path of mlv2dnglocation
log "got to here"
set shellscript to "mkdir -p '" & outputfolder & this_name & "'"
log shellscript
do shell script shellscript
log "here"
set thefirstscript to "cp " & quoted form of myFile & " '" & outputfolder & this_name & "'"
log thefirstscript
do shell script thefirstscript
log "copying"
set thescript to "cd '" & outputfolder & this_name & "' && '" & outputfolder & this_name & "/mlv2dng' " & quoted form of (POSIX path of this_individual_item)
log thescript
do shell script thescript
do shell script "rm '" & outputfolder & this_name & "/mlv2dng'"
end if
end processfile