How to create TAR files
On Mac and Linux
If you have a lot of files to upload you may need to create an archive containing the files. This will simplify and speed up your upload.
Whilst we will accept files in any format, zip and tar (or tar/gzip) are perhaps the best and most commonly used formats for compressed archives.
For users of Unix base operating systems such as Mac and Linux, tar or tar/gzip may be a more familiar archive format than zip.
What is TAR?
Tar by itself is an archiving program, it is used to combine multiple files into a single archive, and on its own does not do any compression to reduce file size. When combined with a compression algorithm, such as gzip, it then also reduces the size.
A compressed tar archive is ideal for uploading as it can store large numbers of files whilst preserving the directory structure as well as making the overall size smaller and thus quicker to upload.
Compression algorithm choice
Tar supports a number of compression algorithms (zip, bzip2, lzip, lzma, lzop, zstd, xz and compress), but gzip is the most widely used and offers a good balance of compression and speed. We therefore recommend gzip where possible.
File naming convention.
When creating a compressed tar file, the file suffix should identify the archive and compression used.
For example:
- my_file.tar.gz
Here the 'tar' and 'gz' suffixes show that this is a tar archive compressed using gzip.
Creating a tar/gzip archive.
Although there are GUI programs that will allow you to create tar/gzip files, both Mac and Linux based systems will have this already built in and it is easy to use from Terminal (or other command line interpreter).
Once you are in the command line/terminal, the syntax is quite simple:
tar czvf myArchive.tar.gz /path/to/folder/containing/my/files
This will create a tar/gzip archive called 'myArchive.tar.gz' containing the contents of the folder you specified.
The 'czvf' in detail:
- c - means create a new archive.
- z - means use gzip to compress the archive.
- v - means be verbose and list the files as they are processed.
- f - tells tar that the next argument (in this example 'myArchive.tar.gz') is the file name that it should create.
If you want to test this, copy or move the archive to an empty directory and from there, again in the terminal, type:
tar xzvf myArchive.tar.gz
and the files should now extract, (the only difference between the two commands is that 'c' create is replaced by 'x' extract).
Windows users
Third party programs (such as the free and open source 7zip) can be used to create tar/gzip, or if you have PowerShell installed the same command should work from PowerShell; but you will probably find it easier to create a zip file instead.
Zip files
Zip files are more commonly used than tar files, and we will accept all formats.
If you prefer to use zip files, you may find our guide to creating zip files helpful.