Shell Script Problems


I would like to be able to call this from a do shell script call in applescript but I don’t now how to get around the special charaters in the command.

The command searchs for all .mp4 files in a drive and returns only their name with the extension removed. One of shell superstars at work put it together for a script I am working on. It works great in shell. I can do all this using text item delimiters to remove the extensions but it is a lot slower than this.

Also “/Volumes/WhateverDrive” & *.mp4" will be a variable acquired in my script.

find “/Volumes/WhateverDrive” -iname “.mp4" | sed 's/^.$/” & "/’ | xargs basename | sed ‘s/(.)../\1/’

any help would be great,

pretty much the rule of thumb goes like this…

enter the shell command into your script as you would in the shell… then try to compile… Wherever it yells about an offending character escape it with


then rinse repeat until the script compiles. So your find statement would look something like this…

do shell script "find \"/Volumes/WhateverDrive\" -iname \"*.mp4\" | sed 's/^.*$/" & "/' | xargs basename | sed 's/\\(.*\\)\\..*/\\1/'"

Thanks James, appreciate it