tar

Python tarfile progress

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 15:49:41
问题 Is there any library to show progress when adding files to a tar archive in python or alternativly would be be possible to extend the functionality of the tarfile module to do this? In an ideal world I would like to show the overall progress of the tar creation as well as an ETA as to when it will be complete. Any help on this would be really appreciated. 回答1: Unfortunately it doesn't look like there is an easy way to get byte by byte numbers. Are you adding really large files to this tar

Remove trailing null characters produced by tar

老子叫甜甜 提交于 2019-12-10 15:45:39
问题 I'm trying tar up some files and pass them along to the user through the php passthru command. The problem is that even though the tar file should only be like 2k it is always 10240. Funny number right? So I have broken it down to: -sh-4.1# tar czf - test | wc -c 10240 VS: -sh-4.1# tar czf test.tar.gz test && wc -c test.tar.gz 2052 test.tar.gz So tar is clearly padding out the file with NULL. So how can I make tar stop doing that. Alternatively, how can I strip the trailing NULLs. I'm running

静态编译ffmpeg

我只是一个虾纸丫 提交于 2019-12-10 15:31:40
静态编译ffmpeg 这两天折腾了一下完全静态编译ffmpeg,期望通过这种方式实现编译出来的ffmpeg能够在各个linux发现版上运行。进而可以延伸到编译出来完全静态的依赖ffmpeg库的应用程序,从而简化产品在各个linux发行版的产品编译和部署区分,减少开发和维护成本。 经过尝试,最终确实编译出来完全静态的ffmpeg,但是也发现了隐患,具体在"一些问题"中描述。所以,我对完全静态编译持保留意见,需要根据实际的使用情况来定。下面的文字,就是我整理的本次尝试的要点了。 1. 静态编译 首先,查看一下之前编译出来的ffmpeg的动态库链接情况。可以看出它链接了许多动态库,这些库有些是系统自带的,有的需要自己安装。 [root@root tmp]# ldd ffmpeg linux-vdso.so.1 => (0x00007fff133fe000) libm.so.6 => /lib64/libm.so.6 (0x00007fb094f81000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb094d65000) librt.so.1 => /lib64/librt.so.1 (0x00007fb094b5c000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fb094958000)

reading files from tar.gz archive in Nim

自作多情 提交于 2019-12-10 14:24:54
问题 Looking for a way to read in a file from a tar.gz archive using the Nim programming language (version 0.11.2). Say I have an archive /my/path/to/archive.tar.gz and a file in that archive my/path/to/archive/file.txt My goal is to be able to read the contents of the file line by line in Nim. In Python I can do this with the tarfile module. In Nim there are the libzip and zlib modules, but the documentation is minimal and there are no examples. There's also the zipfiles module, but I'm not sure

append files to an archive without reading/rewriting the whole archive

梦想的初衷 提交于 2019-12-10 14:02:32
问题 I've got many files that I want to store in a single archive file. My first approach was to store the files in a gzipped tarball. The problem is, that I've to rewrite the whole archive if a single file is added. I could get rid of the gzip compression, but adding a file would still be expensive. What other archive format would you suggest that allows fast append operations? 回答1: The ZIP file format was designed to allow appends without a total re-write and is ubiquitous, even on Unix. 回答2:

Add files from one tar into another tar in python

回眸只為那壹抹淺笑 提交于 2019-12-10 13:38:08
问题 I would like to make a copy of a tar, with some files removed (based on their name and possably other properties like symlink or so). As I already have the tar file open in python, so I would like to do this in python. I understood that TarFile.getmembers() returns a list of TarInfo objects and TarFile.addfile(tarinfo) accepts a TarInfo object. But when I feed one into the other, a corrupted tar is created (without errors). import tarfile oldtar=tarfile.open('/tmp/old.tar',"r") newtar=tarfile

How to create a file of size more than 2GB in Linux/Unix?

半腔热情 提交于 2019-12-10 13:04:40
问题 I have this home work where I have to transfer a very big file from one source to multiple machines using bittorrent kinda of algorithm. Initially I am cutting the files in to chunks and I transfer chunks to all the targets. Targets have the intelligence to share the chunks they have with other targets. It works fine. I wanted to transfer a 4GB file so I tarred four 1GB files. It didn't error out when I created the 4GB tar file but at the other end while assembling all the chunks back to the

Bash: expand parameters from variable. How?

為{幸葍}努か 提交于 2019-12-10 12:08:17
问题 I want to expand tar parameter --exclude thru variable like: set -x verbose EXC=AAA,BBB echo --exclude={$EXC} > /dev/null Output: echo '--exclude={AAA,BBB}' But I expect: echo --exclude=AAA --exclude=BBB I tried different invocations, but nothing.. Whats wrong? 回答1: You need to use eval to parse the line after substituting the variable. eval "echo --exclude={$EXC}" 来源: https://stackoverflow.com/questions/17673337/bash-expand-parameters-from-variable-how

Linux压缩&解压缩

最后都变了- 提交于 2019-12-10 11:46:10
tar命令   解包:tar zxvf FileName.tar   打包:tar czvf FileName.tar DirName gz命令   解压1:gunzip FileName.gz   解压2:gzip -d FileName.gz   压缩:gzip FileName   .tar.gz 和 .tgz   解压:tar zxvf FileName.tar.gz   压缩:tar zcvf FileName.tar.gz DirName 压缩多个文件:tar zcvf FileName.tar.gz DirName1 DirName2 DirName3 ... zip命令   解压:unzip FileName.zip   压缩:zip -r FileName.zip DirName 来源: https://www.cnblogs.com/shwang/p/12015613.html

tar

我只是一个虾纸丫 提交于 2019-12-10 11:36:45
Usage: tar [OPTION...] [FILE]... GNU `tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive. examples: 1、打包一个目录但不包含这个目录里的部分目录 tar -zcvf aaa.tar.gz --exclude=aaa/111 --exclude=aaa/222 aaa 引用关联网址: https://man.linuxde.net/ 来源: https://www.cnblogs.com/koudai191209/p/12015150.html