July 22, 2004

Fedora Core utilities: File Roller

File Roller is a GUI tool that performs file-compression and archiving functions.
In the olden days, file-compression software was a required utility if you were sending files electronically via modems in order to reduce the time (and money) spent online. While file compression isn't quite as important as it used to be, due to the increased pervasiveness of high-speed connections, it's still useful, particularly if you've graduated to sending huge files across the Internet.This article is excerpted from the recently published book Linux Transfer for Power Users.

An archive is a collection of files put into one file. The files can all be in one directory, or they can span multiple directories and subdirectories. Archives are probably more useful now than in the past, as it seems that everyone has a hard disk full of files that they rarely use, but don't dare delete altogether. An archive doesn't have to be compressed, but it often is.

Linux has long had a number of command-line tools that perform these functions, such as tar, zip, gzip, and bzip2. However, each of these requires its own syntax, and a misstep can end up ruining files. File Roller provides a friendly and more foolproof front end for these utilities.
Unlike Windows, where compressed and archived files all end up as ZIP files, each of these Linux functions has its own file format. In addition, when you combine the two functions, the result ends up with either a combination of the two inputs, or a third file format altogether.


Archive file extensions generally end in "ar." For example, the most common Linux archive format, a tar archive, has an extension of ".tar". ZIP files created on a Windows machine have a ".zip" extension (and can be read by File Roller), while tar archives compressed with gzip carry either a ".tgz" extension or a double extension of ".tar.gz". The File Roller help file lists the archive file formats and matching extensions, which are shown in table at left.

Note that the Java archive "formats" (JAR, WAR, and EAR) are just ZIP files with different names. You don't need special tools to work with them.

In other words, you can create an archive without compressing the files in it. The result would be simply an archive file, such as YourArchive.tar. Or you can also compress the files by using a tool such as gzip, in which case the result would be a compressed archive, such as YourCompressedArchive.tar.gz. But you can't just compress a file without creating an archive with File Roller (but you can do it with a compression tool using the command line, of course).

Using File Roller

You can use File Roller to perform two opposite functions. The first is to create an archive, optionally compressing the files during the archive process. Naturally, the second is to extract files from an archive.

To create an archive, run File Roller by clicking Main Menu | Accessories | File Roller.

To create an archive, the first thing you do is create an archive. Ho, ho, ho. Just love saying that. With WinZip, you can create archives on the fly after selecting a bunch of files, or by creating an archive file, sort of as an empty shell. With File Roller, you don't have both options; you need to create the archive file first. Then you add files to it.

To create the archive file, first click the New button on the toolbar (select Archive | New from the menu, or press Ctrl-N) to open the New Archive dialog. Enter a name for the archive file, and then select the type of archive by opening the Archive Type combo box, shown in the figure below.

You can select the type of archive to create via the Archive Type combo box in the New Archive dialog.

If you enter an extension with the name of the archive, keep Archive Type set to "Automatic," and File Roller will automatically determine the archive type from the extension you're using. If you choose an archive type, don't include an extension with the file name, and the appropriate extension will be added to the archive once it's created. In either case, click OK to return to the main File Roller dialog.

You can see the name of the archive in the title bar. Here, the archive is named "SampleArchive.tar.gz". If you decide to abandon the archive process before adding files to the archive file, File Roller will delete the newly created archive file.

Now that you've got an archive file started, add files to it. Click the Add button in the toolbar (or use the menu, or a keystroke combination) to open the Add Files dialog, shown below. You can also drag files from Nautilus into File Roller.

Here I've highlighted three of four files in the directory /home/whil/RollerStuff. Clicking the OK button will add those files to the archive, resulting in a main File Roller dialog.

Note that you could have selected a simple archive, without compression, such as the "tar uncompressed (.tar)" option. Doing so would have resulted in a file named SampleArchive.tar.

Once you've added files to an archive, the disabled options become available. You can choose from a variety of advanced options. For example, you can choose just certain files, according to file name masks (such as *.txt to add just files with a .txt extension) that you enter in the Selection text box. Another option is to add files only if there isn't a newer version already in the archive.

You can also choose to exclude files that match a file name mask (for example, *.zip, in order to exclude other compressed archives), and direct File Roller to ignore case when dealing with file masks.

File Roller will drill down through a subdirectory structure if you select the "Include subfolders" check box. If you do this, the resulting display can be confusing. For example, suppose there was a directory under "/home/whil/RollerStuff" named "RollerSubdirectory."

When an archive includes subdirectories, its main window displays the folder itself, not the contents (the files) of the folder. This is File Roller's default behavior. I don't care for this, because I rarely care about folders more than I care about their contents. You can change the view by selecting View | View All Files. Doing so will change the display of the File Roller window.

Selecting files to add to an archive.

The nice thing about this is that you get the best of both worlds. You can see the files themselves, but you also see the directory location in the last column in the window. In this view, you can see that the file "EvenMoreImportantDataFile.txt" is in the "RollerSubdirectory" directory, as expected. Note that the "/" in the Location column indicates that a file is in the root of the archive, not the root directory of the file system.

Extracting files

Now, how about the reverse-extracting files from an archive?
If the archive file was created with File Roller, regardless of which type of archive and/or compression, you can use File Roller to extract one or more files. Run File Roller by clicking Main Menu | Accessories | File Roller, and you'll see the main File Roller screen.

Next, click the Open button (or select Archive | Open, or type Ctrl-O), and select the archive file you want to work with. The File Roller screen will show the files in the archive.

Select the file or files you want to extract, and then click the Extract button (or Edit | Extract To, or Ctrl-X, or right-click and select Extract To) to bring forward the Extract dialog.

The first thing you'll do is specify where you want to extract the files. Note that the default action is "Re-create folders." This means that if you're working with an archive that includes files that were originally archived with a directory structure, that folder structure will be re-created when you extract the files.

You may want to consider whether or not you want to re-create that structure. For example, I often get files from authors who have included the original path to their files with the archive. I don't want to have to dig through a directory structure that may be four or five levels deep, so I uncheck the "Re-create folders" check box before extracting the files. How do you know if someone has included the directory structure? If you have selected the "View | View All Files" menu option in the File Roller main window, you'll quickly see if there are any directories to deal with.

You are not limited to using File Roller on archives that were created using Linux programs. You can extract files from a PKZIP or WinZip compressed archive using File Roller, and you can usually use those (and other) Windows programs to extract files from File Roller archives.

Click Here!