Search code examples
shelltaribm-midrangefilelist

Store files from a filelist in tarball on IBM i - shell


I want to create a tarfile from a filelist.
The filelist has two rows

log1.dat
log2.dat

The shell script looks like:

cd /temp/temp1 
tar -cvf test.tar -L inp.txt

All files are stored in the dir temp/temp1. The qshell throws an error:

no file or directory with the name inp.txt

but the file is there and named inp.txt.

The test.tar is created and the inp.txt is stored in the archive. I don't want to put the inp.txt in the tarball - I want to store the files listed in the inp.txt.

What's going wrong?


Solution

  • Only the PASE tar utility accepts [ -L InputList ] as a parameter.

    Usage: tar -{c|r|t|u|x} [ -BdDEFhilmopRUsvw ] [ -Number ] [ -f TarFile ]            
             [ -b Blocks ] [ -S [ Feet ] | [ Feet@Density ] | [ Blocksb ] ]           
             [ -L InputList ] [-X ExcludeFile] [ -N Blocks ] [ -C Directory ] File ...
    
    Usage: tar {c|r|t|u|x} [ bBdDEfFhilLXmNopRsSUvw[0-9] ] ]                            
             [ Blocks ] [ TarFile ] [ InputList ] [ ExcludeFile ]                     
             [ [ Feet ] | [ Feet@Density ] | [ Blocksb ] ] [-C Directory ] File ...   
    

    Qualify the path to the utility to use the PASE version:

    /qopensys/usr/bin/tar -cvf test.tar -L inp.txt