I'm trying to create an Automator application which will "touch" all files (or a folder with files inside) dragged to it. Searching through forums etc. I found the following which I've tested in the OSX terminal and seems to work:
So I've added this to an Automator "Run shell script" action like this:
When I run it nothing seems to happen (the Automator cogwheel in the Finder menubar spins indefinitely), so I cancel the task. Then after a while lots of files have their modification dates "touched" including ones outside the folder with the files I dragged to it!
Apparently I can't just paste the terminal code into a "Run shell script" action, so what's the correct syntax for doing this, and how do I prevent touch from touching files outside its surrounding folder?
Code:
find . -type f -exec touch {} +
So I've added this to an Automator "Run shell script" action like this:
Code:
for f in "$@"
do
find . -type f -exec touch {} +
done
When I run it nothing seems to happen (the Automator cogwheel in the Finder menubar spins indefinitely), so I cancel the task. Then after a while lots of files have their modification dates "touched" including ones outside the folder with the files I dragged to it!
Apparently I can't just paste the terminal code into a "Run shell script" action, so what's the correct syntax for doing this, and how do I prevent touch from touching files outside its surrounding folder?