Search code examples
linuxshelltarncftp

How to list all files affected by a tar command?


We run a daily backup script that puts a large tar file on a remote ftp server (with ncftpput). We need to have a local list of contents ("ls -la" or "tar -tvz") of this file without creating this large file locally before it is transferred and without downloading this file after it is saved remotely. The backup script runs a few hours. Therefore the verbose output of tar without detailed information of filesize and timestamp is not sufficient and to run "ls -la" on these files hours later is not a good option, too.

What is the best way to create the mentioned list of contents?
Is there a better way than creating an index file (with tar options "v" and "--index-file=file") and running another local script hours later to get more file information (timestamp and size - that could have changed in the meantime)?


Solution

  • Can't you gather the list while tarring?

    $ mkdir test
    $ cd test
    $ touch a b
    $ tar cvvf ball.tar .
    drwxrwxr-x james/james           0 2017-06-28 14:27 ./
    -rw-rw-r-- james/james           0 2017-06-28 14:27 ./a
    -rw-rw-r-- james/james           0 2017-06-28 14:27 ./b
    tar: ./ball.tar: file is the archive; not dumped
    $