#!/bin/bash ## Tar archives are used to collate multiple files and/or directories into a single file. They are also often compressed to reduce file size, such as with bz2. ## Tar is a standard UNIX program that can be used to both archive and compress, which will use the extension: .tar.bz2. Tar can also then be used to extract the files from an already made Tar archive, such as are often provided by sequencing facilities. ## Tar Variables archive_file=/full/path/to/file.tar.bz2 ## Tar File to Extract From. input_files=/full/path/to/* ## Input Files to Include in Archive. ## Comment (##) and uncomment the below based on whether Tar archive extraction or creation is needed. Extraction uses "-x" parameter and creation uses "-c" parameter. For creation, use "-j" parameter to specify .bz2 compression. ## Tar Archive File Extraction tar -xvf $archive_file ## Tar Archive Creation ##tar -cvjf $archive_file $input_files