Mac Terminal Zip Multiple Files

Zip multiple files on mac; A zip file will be created with the name “Archive.zip“ How to Create a Password-Protected ZIP File on a macOS. Hold Command and Press Space to open Spotlight, type Terminal to search and Enter; Change directory to where files are located by using the command: cd desktop (you can put your path in place of the.

Mac Terminal Zip Folder

  1. Zip -r -s 3g archive.zip FolderName/ The above example will compress everything in FolderName/ into multiple split archives of 3GB maximum each, with the name of the main archive file being archive.zip. You should not drag & drop the folder you want to archive on to the Terminal because it adds the folder’s entire path to the archive.
  2. In the Terminal app on your Mac, use the mv command to move files or folders from one location to another on the same computer. The mv command moves the file or folder from its old location and puts it in the new location. For example, to move a file from your Downloads folder to a Work folder in your Documents folder:% mv /Downloads/MyFile.

Break up huge files into manageable chunks so that they can be uploaded and opened in Excel.

With the recent news that Windows 10 will introduce a UNIX shell, users will have access to a command-line environment on Linux, Mac, and Windows for the first time. And that means you can finally stop bugging the developers at your company to break up the enormous files that Microsoft Excel refuses to open. You don’t need to know anything about the Terminal to do this; although, if you’d like to learn more, check out these tutorials:

Mac terminal zip multiple files in linux

Okay, here’s how it works (for this article, we’ll be working on a Mac, but you can use this method elsewhere).

  1. Open Terminal (Applications/Utilities/Terminal)
  2. Create a new folder on your desktop. This is where you’ll save the file that needs to be split. My folder is called ‘split’ and I have a CSV file that contains a few copies of the English dictionary, or about 2.36 million rows.
  3. In Terminal, navigate to the folder you just created using the ‘cd’ command, which stands for ‘change directory.’
  4. Now, you’ll use the ‘split’ command to break the original file into smaller files. To do this, you’ll type the following, where 250000 is the incremental number of rows at which you want the files to break.

    You can see that the new files are way smaller and have been named in a series of three letters, beginning with ‘xaa.’ These are still CSV files – they just don’t have the ‘.csv’ file extension yet. You can add it manually, but if you have a lot of new files it’s easier to do it through the Terminal.

  5. Make sure that you’re still in the ‘Split’ folder on your desktop using the ‘pwd’ (print working directory) command. Next, paste the following – no need to worry about how it works.
    for i in *; do mv '$i' '$i.csv'; done

    You should now see that all of the split files are saved as comma-separated and will open nicely in Excel.

Mac Terminal Zip Multiple Files Online

Interested in working with us?See our open engineering roles here.

Comments are closed.