Re: Applescript To Unzip Files In A Folder

0 views
Skip to first unread message
Message has been deleted

Emelina Gilpin

unread,
Jul 12, 2024, 8:47:23 AM7/12/24
to lebitderes

The Finder open command can handle unzipping files, which is normally done by the default Archive Utility application. This method unzips the file to the same directory - not sure where your error is coming from, but unless a working directory has been set, the unzip shell utility will unzip to the base/root user directory.

applescript to unzip files in a folder


Download Zip https://urlcod.com/2yWcuh



I have a folder that's automatically given daily zip files. These only contain one file within them. How do I use Applescript to unzip these, regardless of their name and how many there may be?

Unzipping a file is not the hard part of your question. The hard part is the renaming because we do not know what files/folders are unzipped. So the strategy here is to get a list of all the items in the folder prior to unzipping, get another list of all the items in the folder after unzipping, then compare the 2 lists. The items that are in the second list that aren't in the first list are the unzipped items... so we can rename them if their name is not the same as the zip file.

If the archives have AppleDouble files, unzip creates a __MACOSX folder instead of converting them back to extended attributes or other metadata. unar would preserve the information in AppleDouble files.

On a MAC, When I zip and unzip files using finder or using zip/ditto from command line, I lose the creation date of the files/folders and the creation date is automatically set same as the modification date. How can I preserve the creation date? Does AppleScript do it?

Hi I want to make an Applescrit which unzip a file (which is located in the Applescript-Application).The file should be unzipped to the right side of the Application Dock (not to the folder side). ( If there's also Terminal programmation needed it should hide terminal) The name of the app is install.app and one of the zip-file is install1.zip

Secondly, where do you want to extract the file to? You cannot unzip a file to the Dock. The Dock doesn't contain files, it just contains pointers to other files on the disk. Therefore you have to unzip the file somewhere, and then tell the Dock to add a link to that file.

Change the first line, of course, to reflect where you actually unzip the file to. It's not a good idea to add files from /var/tmp to the dock since the user can't usually get to this location in the Finder

FWIW, the included unzip version 5.52 within OS X is old, and only works correctly on zip files of 2 GB or smaller. If you're dealing with larger zip archives, you'll want and need to download unzip 6.0 separately.

Thanks Viking. Yes that works. Seems that the key is specifying a different output directory than the original containing folder of the ibooks file. Wish I had more time to sleuth out why I can use terminal to unzip into the original parent folder, but not via my AppleScript's shell command (even with admin priv). Moving on ... to re-zipping! :-) Ted

If you are not on Lion (or even if you are), then I highly recommend The Unarchiver which works on 10.4+. It can:* extract zips to a specific directory (I use /Unzips)* always unzip to a new folder (which makes them easier to find, some files unzip to a different name, which is probably part of the confusion you are facing) * and it can set the modification date to the current date/time, which will help the sorting problem:* it can automatically open folder it creates (so you don't have to go hunting for it)* it can either keep the the original .zip or move it to the trash.

I have a bash script that invokes the unzip command, and it needs to extract just the files in which the path to the file includes a subdirectory name that is one of 3 particular words: "a", "apple", and "applescript". So the file /a/b/c.txt and /com/apple/foo.txt should both be extracted.

I know that with normal bash command-line globs, I can use something like */a,apple,applescript/*.txt, but that's not applicable here because the unzip command is the thing that is evaluating the glob, rather than bash.

Archives and compression techniques are the go-to solution for storing and sending a lot of files, making files smaller in size and easier to organize. The most common and accessible archive and compression format is ZIP, which also features a lossless algorithm (so the quality remains the same). Its icon is typically a folder with a zipper in the middle.

A ZIP file is a type of a compressed folder with files that have been reduced in size. Similar to a standard folder on your Mac, ZIP files contain items together in one place, but the contents are compressed, which reduces the amount of data used by your Mac. Some people also describe ZIP files as an archive.

Terminal is an app that provides text-based access to the macOS operating system in a command line interface. If you like Terminal and are comfortable with it, you can use commands to unzip files on Mac. Follow these steps:

BetterZip offers automatic previews of zipped files and folders on the right side of the app window. To see files inside a ZIP, simply launch the app, select your archive and a preview will load immediately.

The only option to add more files into an existing ZIP archive on Mac is to open ZIP, in other words extract files into a regular folder, move additional files in, and then zip that folder again. If that seems like a hassle, using BetterZip will be more enjoyable.

If anyone here work with Adobe Bridge you can go to the folder that contains subfolders click in Show > Show subfolder items. Then you select all files click in the right button over and click in > Move. Choose the place you want to move.

You might not realize it, but your compressed files often contain duplicate files, adding to the size of your zip file. WinZip Mac detects and zips duplicate files using an internal link to save you space. Your unzipped duplicate files remain the same size and structure, but your Zipx files will be smaller than ever.

Simply copy and paste files from your Mac to a Zip or Zipx file. This quick step allows you to transparently manage what you want to add to a Zip as you copy files from a folder and paste to your Zip file, replicating your file and folder structure.

Review PDF files before unzipping them and select what file to extract before extracting them. You can also view each file as a thumbnail and review the content type before extracting it, which saves time, and keeps the files organized.

Pretty straightforward: First I create a FM file path in the $File_fm variable, that I then use the Insert File script step. Now I have my (original) unzipped file back in FileMaker. This really saves space, when you have a lot of files.

Now you don't want to move those files, right? You want them to stay in /Library/Messages/Attachments so as not mess up your Messages app. So create a new folder in another Finder window, and then hold the Option key down and drag them all to the new folder. You should see a + mark under the cursor as you drag, indicating the items will be copied, not moved.

There is where the topic of this video came in. Typically, I'm using a plugin to manipulate files and folders. I opt to use 360Work's ScriptMaster (of which there is a free version). The problem, however, if you haven't already figured it out, is that I can't us a plugin if it's not already installed yet. And I needed a folder in order to install the plugin - otherwise FileMaker was throwing an error.

I'm sure you figured this one out, but yes, this is a nice way to work with folders. If anyone takes a bit more time and learns about redirecting input and output from the command line then you can do a bunch of stuff with files too. ;)

I am using this technique to export a Mac plugin. Because of the plugin format I must zip it to include in a container field. I get it exported to the shared auto update folder just find. Then I want to open the .zip file which will force an unzip. I am using the following but getting an error and no unzipping:

As an alternative to the automator script here is my short applescript to do the same.
It saves embedded images in the same directory but still require manual tweaks afterwards to fix the links. Be also aware, there are backslashes dusting imported markdown files. They came from unmatched HTML from notes.

When it comes to how to unzip files on Mac, there are several ways to get the job done. In this article, we have gathered the most common ways for unzipping files on Mac, as well as reviewed some of the unzip software that can help you manage archives.

We'd like to draw your attention to Commander One. It is a powerful file manager for macOS that provides a convenient way to unpack archives. The app supports a variety of archive formats, making it an ideal choice for unzipping files on Mac. Besides that, according to reviews, it is one of the best file managers for macOS, providing high performance and ease of use.

To view and use the files stored in the archive, you need to open ZIP files on Mac, that is, extract the files to a regular folder. The unpacking process on macOS devices is quite straightforward; there is a built-in tool as well as third-party archive utility Mac apps users can rely on.

Being a powerful file manager and ZIP extractor for Mac, Commander One allows you to not only open .zip on Mac but also pack files and folders into different archives and even go through the content of the archive without extracting it. With the help of this unzip software, you do not need to open Terminal if you wish to protect your archive with a password, as this feature is already implemented.

If you are looking for a solution that helps you unzip files on Mac for free, consider StuffIt Expander. The tool is fully compatible with various formats, including ZIP, RAR, TAR, and GZIP, so that you can open almost any compressed file without problems.

Definitely, ZIP files are the most common ones you find on a daily basis, but in some situations, you may have to work with other archive types, and this is where you have an essential issue that you run into not only how to unzip files on Mac but also how to deal with other archive formats. And that's where a reliable unzip solution comes in handy.

aa06259810
Reply all
Reply to author
Forward
0 new messages