Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a custom Service I created in Automater. Right now, the service shows up in my context (right-click) menu, when right-clicking on any folder. In Automater, I added the Run AppleScript action, to execute this code:

on run {input, parameters}
    do shell script "/usr/bin/find ./ -type f -name .DS_Store -delete -print"
    return input
end run

My objective is to delete all .DS_Store files in the selected folder (and all folders within it). I normally do this in Terminal by executing /usr/bin/find /path-to-folder -type f -name .DS_Store -delete -print, but I would love to get this to work from my custom Service.

I'm thinking I need to pass the selected folders path to the AppleScript function (through input perhaps?), but I have no idea how, nor do I see any actions in Automater to pass this. I'm using OSX 10.6.5. Any ideas or suggestions?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

At the top of the screen, above your action, there should be a list-box that says Service receives selected <text> in <any application>. Changing <text> to folders should give you the folders as input.

share|improve this answer
    
Thank you. That's it. You wouldn't happen to also know how to convert the path it passes Macintosh HD:Users:Matthew:Documents:Programming:Apple Scripts: to a path like Macintosh\ HD/Users/Matthew/Documents/Programming/Apple\ Scripts? –  matthewpavkov Dec 14 '10 at 3:33
    
@matthewpavkov: unfortunately no... but there might be a command line utility. feel free to create another question, I'm sure someone around here knows :P –  Robert S Ciaccio Dec 14 '10 at 3:46
1  
Thanks again! –  matthewpavkov Dec 14 '10 at 3:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.