Thursday, January 29, 2009

Creating Unix/Linux Shar archive files on Windows System

Shar archive file format



In the Unix operating system, shar (an abbreviation of shell archive) is an archive format. A shar file is a shell script, and executing it will recreate the files. This is a type of self extracting archive file. It can be created with the Unix shar utility. To extract the files, only the standard Unix Bourne shell sh is usually required.

While the shar format has the advantage of being plain text, it poses a risk due to being executable; for this reason the older and more general tar file format is usually preferred even for transferring text files. GNU provides its own version of shar in the GNU Sharutils collection.

Shell archive is a shell script that, when executed on a POSIX-compliant system, will recreate a collection of file system objects. Shar files are shell scripts and can theoretically do anything that a shell script can do (including using incompatible features of enhanced or workalike shells), limiting their utility outside the Unix world.

  • Shar:
    The traditional shar format uses a limited set of
    POSIX commands,
    including echo, mkdir, and sed. It is suitable for
    portably archiving small collections of plain text files. However,
    it is not generally well-suited for large archives (many
    implementations of sh have limits on the size of a script) nor
    should it be used with non-text files.

  • Shardump: This format is similar to shar but encodes files using
    uuencode so that the result will be a plain text file regardless
    of the file contents. It also includes additional shell
    commands that attempt to reproduce as many file attributes as
    possible, including owner, mode, and flags. The additional commands
    used to restore file attributes make shardump archives less
    portable than plain shar archives.

Using WinTar



WinTar is a simple and cute 32-bit Windows version tarball archiver - a powerful tool which allows Windows users to create, manage and extract most popular Unix/Linux tarball and windows format archive files.
WinTar can create and read several different archive formats, including most popular tar variants, several cpio formats, and both BSD and GNU ar variants. It can also write shar archives and read ISO9660 CDROM images, Windows CAB and ZIP archives.

Introduction: http://www.miscosoftware.com/WinTar/wintar.htm

Download: http://www.miscosoftware.com/WinTar/store/WinTar.exe

Creating shar archive file:


When WinTar is running, it displays a list of files and folders in the current folder. Navigate to the folder that you want to add files and folders to the archive. After you select the files and folders and then do the following:

  • » Select menu File New archive and then select the archive file format from the popup menu, Shar File/Shar dump file. or

  • » Click the main toolbar button New popup tag. When the popup menu displayed, select the Shar File/Shar dump archive file format.

These two methods will display the New Achive dialog. Navigate the folder you want to save the archive file, enter the archive file name in the File Name text box. At this point, you also have a chance to select the target archive format at the next Save File Type and Archive Format combo boxes. You may select the compression method from the Compression combo Box, e.g. gzip,bzip2 or leave it as Using global options. Select None method, the archive will perform but do not apply compression, including Zip and CAB archive.



After click the OK button at the New Archive dialog, If you have selected files and/or folders on the first step, the Archive File Option dialog will display (the Globle Options controls this behavior). After select some archive options and click OK button, the archive process starts.


Other Articles


Extracting files from ISO image file

Creating/Extracting CAB archive file

Creating/Extracting Zip archive files using WinTar

Creating Unix/Linux tar, tar.gz archive on Windows System

How to create/extract CPIO archive files on Windows

Create Unix Pax archive files on MS Windows system