Re: Get Selected Finder Items behavior
Re: Get Selected Finder Items behavior
- Subject: Re: Get Selected Finder Items behavior
- From: Scott Haneda <email@hidden>
- Date: Mon, 2 Mar 2009 15:03:24 -0800
Cool, that is what I just did.
I want to conditionally zip a dir, and leave files alone.
If I just `zip "$f".zip $f` I end up with a zip, so it works, but the
zip contains a set of directoies up to the real files, so it took in
the $f as a full path, and used that to create a tree, much like mkdir
-p.
Seems to happen a lot, what is the best way to chop off the path in $@
iterations? `basename` comes to mind, is that how most would do it in
automator workflows?
Thanks
On Mar 2, 2009, at 2:58 PM, Itai Rom wrote:
Yeah, you could do something like this in your Run Shell Script:
for f in "$@"
do
if [ -d "$f" ]; then
# do whatever you need to do here
echo "$f"
fi
done
-Itai
On Mar 2, 2009, at 2:44 PM, Scott Haneda wrote:
Perfect. Now I want to be able to tell if the items dropped were a
set of files, or if they are directories, can you suggest a simple
way to tell if "$@" is a directory?
Do I just do the basic if [ -d "$@" ]
Thanks
On Mar 2, 2009, at 2:37 PM, Itai Rom wrote:
In general, the files you drop on your applet will be the input to
the first action in your workflow. So sure, if you start the
workflow with Label Finder Items, then it will label the files you
dropped on the applet.
This is why you're getting the duplicates in your workflow below.
The files are passed into Get Selected Finder Items, which then
appends the Finder's selected files to its input and passes that
list of files on to Run Shell Script, so you end up getting each
file input into Run Shell Script twice. It's as if you started
your workflow with two Get Selected Finder Items actions.
Hope that clears things up
--
Scott
* If you contact me off list replace talklists@ with scott@ *
--
Scott
* If you contact me off list replace talklists@ with scott@ *
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden