tar

pipe tar extract into tar create

↘锁芯ラ 提交于 2019-12-08 00:44:28
问题 I have a tar.gz right now, and I want to extract just a file or two from it, and pack/add those into a new tar.gz, all in one go. Of course I can just save to a temporary file and work with it, but the ABSOLUTE requirement is to do this all without having any intermediate file output, i.e. piping. In other words, what I would like is something like the following pseudo-code (obviously the syntax is incorrect) tar -xvf first.tar.gz subdir1/file1 subdir2/file2 | tar cf - | gzip > second.tar.gz

Ansible copy and extract archived file from remote server to another

家住魔仙堡 提交于 2019-12-07 21:43:06
问题 I'm generating an archived file on remote server A. e.g. /tmp/website.tar.gz and want to transfer/copy and extract the file to the remote server B (/var/www). How do I do that in Ansible? My Ansible script to create archived file: - name: archive files shell: tar -zczf /tmp/website.tar.gz . args: chdir: "{{ source_dir }}" tags: release - name: copy archived file to another remote server and unpack to directory /var/www. unresolved.. Update: Can I use the rsync module? . I'm trying to use the

Java Compress Large File

纵饮孤独 提交于 2019-12-07 18:37:46
问题 I'm working on an app that works with some very large files each are around 180mb and there are 3 of them. I would like to add an option to my app to back these files up by compressing them in a zip or a tar or something. What is the best option would be to compress them down as much as possible in Java? Tar? Zip? Gzip? 回答1: You can do this programmatically using Apache Compress. 回答2: Look at the classes in the java.util.zip package. 回答3: Alright went with zip here is the method i used. I

Docker学习:Image的本地存储结构

筅森魡賤 提交于 2019-12-07 13:35:21
写在前面 在使用Docker时候,针对镜像的操作一般就是 docker pull , docker build , docker commit (刚开始接触Docker的时候,还不会Dockerfile,经常使用这个命令,但是经历了一次血的教训,我已经放弃这个命令很久)这些操作,大概都知道Images在Docker中是由无数个Layer组成,但是,Image在本地是如何存储的?上述操作又会对本地存储带来怎样的变化?抱着学习的态度,我从刚刚安装完docker开始,一步一步研究docker image的目录结构和含义。 本人也只是docker初学者,写文章的目的也是希望自己不仅仅停留在会使用docker的阶段,还能够边用边学边总结,一方面加深自己的理解,另一方面希望通过这种方式与一起学习Docker的童鞋们交流。如有错误,欢迎批评指正,谢谢。 背景:Image 大小无法压缩引出的问题 以前基本都在本地服务器上使用Dockerfile构建镜像,一般来说磁盘的空间都是足够的,而且基本不需要docker save,应用场景也不存在频发启动容器的情况,所以不管是空间还是效率的角度,都没有刻意去压缩构建出来的镜像大小。但是,最近因为需要在VPS上构建,可用的空间严重受限,因此,觉得重写Dockerfile来压缩镜像大小。本以为应该是一件很简单的事情,果然太年轻。直接从dockerfile说起:

about LinkedIn glu

血红的双手。 提交于 2019-12-07 10:08:51
最近在预研自动化部署方面的可行性,计划从开源框架中先熟悉一下其他公司是如何实现,偶然发现了GLU,尝试搭建了一下,安装过程中出现了一些问题,作为备忘记录如下: 一、安装环境 os: Solaris 10 5/08 s10x_u5wos_10 X86 bash:GNU bash, version 4.2.0(1)-release (i386-pc-solaris2.10) JDK:java version "1.6.0_43" 二、安装过程与问题解决 1)解压文件 tar -xvf org.linkedin.glu.packaging-all-4.7.1.tar 错误信息: x org.linkedin.glu.packaging-all-4.7.1/setup/org.linkedin.zookeeper-cli-1.5.1/lib/netty-3.2.2.Final.ja, 785556 bytes, 1535 tape blocks tar: ././@LongLink: typeflag 'L' not recognized, converting to regular file x ././@LongLink, 113 bytes, 1 tape blocks x org.linkedin.glu.packaging-all-4.7.1/setup/org.linkedin

Pipe script and binary data to stdin via ssh

放肆的年华 提交于 2019-12-07 09:45:59
问题 I want to execute a bash script remotely which consumes a tarball and performs some logic to it. The trick is that I want to use only one ssh command to do it (rather than scp for the tarball followed by ssh for the script). The bash script looks like this: cd /tmp tar -zx ./archive/some_script.sh rm -r archive I realize that I can simply reformat this script into a one-liner and use tar -cz ./archive | ssh $HOST bash -c '<commands>' but my actual script is complicated enough that I must pipe

How to list the contents of a compressed tar file in Java

淺唱寂寞╮ 提交于 2019-12-07 07:00:00
问题 How do I list the contents of a compressed tar file in Java without extracting the files? I have looked at apache ant api, and I can see how to extract files, but I cannot work out how to just list them. The tar files are either bz2 or gz. 回答1: I recommend using TrueZIP. It's really good. TrueZIP is a framework for virtual file systems and a library for accessing archive files as if they were just plain old directories. As a framework, TrueZIP provides the interfaces and classes to write file

Gzip/TAR libraries for Javascript

╄→гoц情女王★ 提交于 2019-12-07 03:54:11
问题 I would like to know this please, I am aware of some libraries that will access zip files but I would like to do this with tar files. Thank You 回答1: Take a look at this article Parsing tarballs with JavaScript 来源: https://stackoverflow.com/questions/7930353/gzip-tar-libraries-for-javascript

How to determine if data is valid tar file without a file?

▼魔方 西西 提交于 2019-12-07 03:25:19
问题 My upload form expects a tar file and I want to check whether the uploaded data is valid. The tarfile module supports is_tarfile(), but expects a filename - I don't want to waste resources writing the file to disk just to check if it is valid. Is there a way to check the data is a valid tar file without writing to disk, using standard Python libraries? 回答1: Say your uploaded data is contained in string data . from tarfile import TarFile, TarError from StringIO import StringIO sio = StringIO

How do I compress a folder with the Python GZip module?

£可爱£侵袭症+ 提交于 2019-12-07 02:06:02
问题 I'm creating Python software that compresses files/folders... How would I create a section of the code that asks for the user input of the folder location and then compresses it. I currently have the code for a single file but not a folder full of files. Please explain in detail how to do this. 回答1: The code to compress a folder in to tar file is: import tarfile tar = tarfile.open("TarName.tar.gz", "w:gz") tar.add("folder/location", arcname="TarName") tar.close() It works for me. Hope that