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

Unstuff from the commandline UNIX
It's been a personal peeve of mine that Aladdin makes a CLI interface to their product for Linux, but not for the Mac. Here is a quick alias to fix this. It's not perfect (if you aren't logged in, this will have problems), but it works. The command to create the alias is:
alias   unstuff "open -a '/Applications/StuffIt Lite 6.5/StuffIt Expander.app'"
(your path to StuffIt Expander might be different)

Example usage:
% unstuff somearchive.sit

[Editor's note: To make this alias permanent, search here for 'alias' for instructions on creating your own alias file.]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[10,334 views]  

Unstuff from the commandline | 4 comments | Create New Account
Click here to return to the 'Unstuff from the commandline' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Why are we all stuck on Stuffit?
Authored by: avit on Jan 07, '03 09:16:17PM

Stuffit bugs me. It's the only compression program that isn't accessible from the command line. This tip will work only if the user is logged into the machine and can launch the StuffIt Expander.app. The whole point of the command line is that it enables the power of running tasks unattended or remotely. I can't expand a file if I'm not physically present at the machine to log in, and I can't schedule a cron job to do it either.

We can mount disk images. We can run installers. All remotely, or unattended! But we can't do the simplest task of unpacking a downloaded file! Shameful!

For OS X files, I can't think of a single reason to continue using .sit format files. Historically the format was helpful because it packed resource and data forks together for compression, but now that resource forks are becoming less prevalent, why use it? Why aren't we using a more universally accepted format like .zip or .gz, especially for simple things like .dmg files?



[ Reply to This | # ]
resource forks and mac metadata
Authored by: wal9000 on Jan 31, '03 10:57:00PM

you answered your own question, really... stuffit preserves not only resource forks, but mac metadata as well.

i agree though that it would be good to move toward more open formats. someone needs to write a nice stuffit-like graphical shell for hfspax + gz, for example...



[ Reply to This | # ]
Stuffit should have cli for OS X, but...
Authored by: macmath on Feb 01, '03 06:05:53PM

I agree, Aladdin should have cli commands available for Stuffit Expander and Stuffit, however, they probably want to continue to get as many people to have to buy Stuffit Deluxe as possible (for all those contextual menu thingys). In the mean time, if you do want to do something remotely (over TCP/IP) or automated with cron, you use AppleScript. Up until this most recent version (7.0.1), these products have been essentially immune from scripting (by me anyway :-)) except to open or close. With this version, one can script them to stuff and expand items. Here is a rough script to stuff all items in a particular folder and delete the original. It can be used with cron, or within a folder action (and therefore the location of the folder would not be required). I use it, and it works for me, but I'm sure it needs a lot of work to make it nice. Greater complexity is required because while stuffing via AppleScript, it does not know the item has already been stuffed, so I had to have it check.

tell application "Finder"
set item_count to count items in the container "users:shortname:documents:transfer"
end tell
if item_count is not equal to 0 then
set k to 1
repeat while k is less than (item_count + 1)
tell application "Finder"
set temp to item k of the container "users:shortname:documents:transfer:"
set next_file to temp as string
if ".sit" is not in next_file then
tell application "DropStuff"
open file next_file
end tell
tell application "Finder"
move next_file to trash
end tell
end if
set k to k + 1
end tell
end repeat
tell application "DropStuff"
quit
end tell
end if

To use Applescript over TCP/IP, the general tell command begins "Tell application "nameOfApp" of machine "eppc://..." The remote machine must be set up to allow Apple Events. Of course, it is a lot more typing. To stuff only one item, it would be much easier, but still a lot of typing.

tell application "Finder"
set temp to item 1 of the container "users:us:bin:"
set the_file to temp as string
tell application "DropStuff"
open file the_file
end tell
end tell

If you knew the name of the file, that would make it easier as well

tell application "DropStuff"
open file "pathToFile"
end tell

Sorry for the long post.



[ Reply to This | # ]
More flexibility with Script Editor 2.0 installed.
Authored by: macmath on Feb 01, '03 06:57:57PM

...by the way, if you have the 2.0 beta of Script Editor installed, you can write this script in any application to which "Services" are available (and in which you can enter text, such as TextEdit), and run the script from "Services". Thus, neither Script Editor nor compiled scripts are necessary.



[ Reply to This | # ]