In Automator, how to get the folder contents after a "Run Shell Script" action I have an Automator application where I'd like to drag a folder onto it and have it create a duplicate (sibling) of that folder with the duplicate's files renamed. For example, starting with the following:

root
 +--svgs
     |--icons_a.svg
     +--icons_b.svg


When dragging the svgs directory onto the application, I would like to end up with the following:

root
 |--svgs
 |   |--icons_a.svg
 |   +--icons_b.svg
 +--renamed-svgs
     |--a.svg
     +--b.svg


I've tried the following:


But it throws the following: 



Not sure how to debug the error, but how can I get the first "Run Shell Script" action to return either the "renamed-svgs" folder or that folder's contents?

Or is there a better way to do this whole thing?
It is generally advisable to enclose a variable in double quotes.

Use the echo command to return the "renamed-svgs" folder 

rm -rf "$@"/../renamed-svgs
cp -rf "$@"/ "$@"/../renamed-svgs
echo "$@"/../renamed-svgs/




Or use the find command to return files whose name start with icons_

rm -rf "$@"/../renamed-svgs
cp -rf "$@"/ "$@"/../renamed-svgs
find "$@/../renamed-svgs/" -type f -maxdepth 1 -iname 'icons_*' -print