You can also create a “Service” , which is now called “quick action” I believe, inside automator, and include “run shell script” as action. In the shell window you can choose to send the files and folders as standard input or as parameters.
I generally pass them as parameters and then use a script like this:
for f in $@
do
touch "$f"
done
Obviously replace “touch” with whatever command you need to run on the files.