0

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)?

hellcode
  • 2,678
  • 1
  • 17
  • 21
  • How do your script select the files it should include in the backup? If the script knows what files it will put in the archive, then it can also list them. – Some programmer dude Jun 28 '17 at 09:51
  • The tar command has many dynamic exlude options. – hellcode Jun 28 '17 at 09:53
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Jun 28 '17 at 17:23
  • 1
    @jww: I don't agree. The solution was just an option of an essential packing program, but the question is about programming backup scripts and may be useful for others. – hellcode Jun 28 '17 at 17:38

1 Answers1

1

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
$
James Brown
  • 36,089
  • 7
  • 43
  • 59
  • 1
    Great, the double use of option "v" is changing the output from short to long version. Haven't found anything about that in manuals. Thank you so much. – hellcode Jun 28 '17 at 12:28