Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A Perl script to manage file types and creators' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A Perl script to manage file types and creators
Authored by: merlyn on Dec 07, '03 11:06:25AM
The scripts I've seen in this thread are safe for filenames that contain space, but dangerous for filenames that contain single-quote or backslash, and sadly they're needlessly dangerous.

Please remember... instead of backquotes, you really want code like:


system 'SetFile', '-c', $creator, @ARGV;
Then, everything is safe, as the names are passed from parent to child without hitting the shell.

I'm willing to preview any Perl script posted here before posting for security and best practice. Please give me a couple of days, and email it to merlyn@stonehenge.com and mention macosxhints. Thanks.

[ Reply to This | # ]

A Perl script to manage file types and creators
Authored by: Handycam on Dec 07, '03 11:33:43AM

Thanks for the tip.

Actually, I fail to see the advantage this script provides over the standard SetFile command,

SetFile -c "R*ch" -t "TEXT" *.html

What would be the advantage in using this script instead?



[ Reply to This | # ]
A Perl script to manage file types and creators
Authored by: mraltivec on Dec 07, '03 05:02:17PM

Advantages over SetFile/GetFileInfo:

1) Easier to type and remember (shorter, no mixed case)

2) Combines GetFileInfo and SetFile functionality into one command

3) Can handle multiple files and wildcards (GetFileInfo does not)

As always, YMMV.



[ Reply to This | # ]