do shell script problem with files with spaces in the name
do shell script problem with files with spaces in the name
- Subject: do shell script problem with files with spaces in the name
- From: Joe Block <email@hidden>
- Date: Sun, 15 May 2005 18:03:58 -0400
I am probably just doing something wrong, but I've tinkered for a bit
and haven't gotten things to work the way I expect.
For my first Automator project, I wanted to write a workflow to use
SetFile to fix the file types of some files a windows-using client
uploaded to my ftp server at work so our admin staff can open them in
Excel without bugging me to fix the file types. This seems like it
should be simple enough, but I can't get the workflow to correctly
handle files with spaces.
Here are the details of the workflow I created to process a folder
tree and run a unix command on each file in the tree.
Step 1: Get Selected Finder Items
Step 2: Get Folder Contents, with "repeat for each subfolder found"
checked
Step 3: Run shell script with "Use input as arguments" checked.
The shell script is a simple ruby script, testit.rb (source follows):
-- cut --
#!/usr/bin/ruby
ARGV.each {|arg| puts arg}
-- cut --
If I open a terminal window and invote testit.rb as
testit.rb /path/to/dir/with/files/with/spaces/in/the/names/*
it correctly prints all the file names, including the ones with
spaces in them, one per line.
Once I add it testit.rb to the workflow however, Automator chops up
the filenames, and if I have a file named "one two three", the "one",
"two" and "three" show up as separate lines of output.
Am I doing something wrong here, or is Automator's handling of
filenames broken?
And yes, I could write this using find, but I wanted to create
something simple enough to hand to my decidedly non-technical users
at work.
jpb
--
Joe Block <email@hidden>
407.284.7578
Have GNU, will travel.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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