Expand/rename archive

Hello. I've been trying to create an Automator workflow to copy the name of an archive to the expanded folder, replacing a generic folder name from what I suppose is an improperly zipped archive --i.e., archive is named "ADescriptiveName.zip" but the expanded archive is a folder simply named "Folder--I want to copy the archive name to the folder".

I don't see a usable action except for the "Expand Archive" action from StuffIt Deluxe 12 (which I own), and, the Stuffit action only seems to give the option to designate specific locations for expansion--i.e., the Desktop or some other directory. Is there any way to get it to expand to the same location as the archive (as is allowed in the Expander preferences), or is there a way to use the OS X's Archive Utility to do this (I see OS X actions to create archives, but not expand them).

Or is there another way to do this?

PowerMac G5 dual-2GHz

Posted on May 14, 2008 7:17 AM

Reply
2 replies

May 14, 2008 7:41 AM in response to Scott_R

Response I received from Smith Micro on the topic:

+No, there is no way to do this with the Automator plugin. We are using our expand engine only. Everything else is being done with Finder and the OS. So, the drop-downs and options you see for where the files will go all have to do with MAC OSX. We apologize that this doesn't work exactly as you wish. This is not something that Smith Micro can change as we must follow the OSX guidelines.+

May 14, 2008 5:10 PM in response to Scott_R

Yes, you can expand it with Automator. The trick to figuring this out was realizing Finder is the default app for opening (uncompressing) them, as well as creates ZIP archives. 😉

Simply add the action "Open Finder Items" after the action supplying your archive (such as "Get Selected Finder Items"). You can leave the setting to "Default Application" and the Finder will automatically uncompress it, and within the the same folder (just as you want, right?).

The tricky part is renaming the folder that has been uncompressed. Unfortunately and correctly (in order to be consistent), the file that is passed into "Open Finder Items" is the same one that comes out of it. I think it's expected that once you've opened a document with an application, the application isn't going to give anything back. Yet, this is one of those rare circumstances when you want the results of the application opening the document, instead of the original file.

However, since you said that the archive contains one folder named "Folder", you could try obtaining it with the action "Find Finder Items". Specify the folder containing the archive, then set the "Name" to "is equal to" and "Folder". Use the "Results" button at the bottom of the action to view what files the action finds. There are problems with this, such as accidently matching a folder insider the newly uncompressed "Folder".

Instead, I think after getting Automator to uncompress the file with "Open Finder Items", you would add the action "Run AppleScript". The AppleScript you'd need would process the alias that comes out of the previous action (Open Finder Items) by getting the folder the archive is in (easy), getting the name of just the archive (easy) and reformatting it the way you like (tricky), and then renaming the newly uncompressed folder named "Folder" to the new name (easy). Lastly, you'd pass the alias of the renamed "Folder" on to the next action "Create Archive". Sorry, I don't have such a script. 😟

In "Create Archive", leave the name blank to keep the same name (the new name you've given it with the AppleScript), and then select the path by choosing "Same Folder as Input".

Hmm, now if only I had time to fiddle with a script for that renaming part...

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Expand/rename archive

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.