Skip to main content
spelling
Source Link
oa-
  • 7.8k
  • 5
  • 24
  • 45

I have a custom Service I created in AutomaterAutomator. Right now, the service shows up in my context (right-click) menu, when right-clicking on any folder. In AutomaterAutomator, 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 AutomaterAutomator to pass this. I'm using OSXOS X 10.6.5. Any ideas or suggestions?

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?

I have a custom Service I created in Automator. Right now, the service shows up in my context (right-click) menu, when right-clicking on any folder. In Automator, 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 Automator to pass this. I'm using OS X 10.6.5. Any ideas or suggestions?

edited tags
Link
Robert S Ciaccio
  • 5.7k
  • 3
  • 43
  • 52
Source Link
matthewpavkov
  • 414
  • 1
  • 4
  • 12

Passing selected folder path to custom Service executing AppleScript

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?