Sponsored Content
Top Forums Shell Programming and Scripting Extracting from archive | compressing to new archive Post 302381724 by chebarbudo on Sunday 20th of December 2009 04:48:18 AM
Old 12-20-2009
Question Extracting from archive | compressing to new archive

Hi there,

I have one huge archive (it's a system image).
I need sometime to create smaller archives with only one or two file from my big archive.
So I'm looking for a command that extracts files from an archive and pipe them to another one.
I tried the following :
Code:
tar -xzOf oldarchive.tgz ./file1 ./file2 | tar -czf newarchive.tgz

But it doesn't seem to work: it says:
Code:
tar: Cowardly refusing to create an empty archive

Can anybody explain me why?
Does anybody have a better idea?

Thanks for your help.
Santiago
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Q: tar archive help

hey how do you create a archive and add file to an existing archive. i keep getting an error: dir/#: No such file or directory currently using tar -cvfu name.tar files files searching from a word document each line having different file extention. Thanks in advance (1 Reply)
Discussion started by: nookie
1 Replies

2. UNIX for Dummies Questions & Answers

Extracting from a tar archive file

Can I extract files from an archive file (tar), where the filename includes the full directory path, to a different directory? For example the archive files may have a filename of /SrcFiles/XXX/filename.dat and I want to extract it to /SrcFiles/YYY/filename.dat. Since the archive file was... (1 Reply)
Discussion started by: nmalencia
1 Replies

3. UNIX for Advanced & Expert Users

overhead in the archive

Hi everyone, I am currently trying to work out the size overhead in the library archive. The total size of all my objects file is about 100KB. However, when I package them into the archive (libXX.a), the size gets boosted up to 200KB. I want to know what exact is that 100KB overhead. I tried... (1 Reply)
Discussion started by: jasoncrab
1 Replies

4. Shell Programming and Scripting

RCS archive in /etc

Well it is not a bad idea. I have worked for one place that did that. It wasn't my idea but I did not object. The reason it is done is to put critical files like nsswitch.conf, hosts, and so on under RCS control. Previous versions are then available to see how stuff changed over the years. ... (0 Replies)
Discussion started by: Perderabo
0 Replies

5. Shell Programming and Scripting

Read specific file from a zip archive without extracting

Hi All, I would like to extract specific file from a zip archive. I have a zip archive "sample.zip". sample.zip contains few text files and images... text1.txt, text2.txt, pic.jpg etc... I need to read specific file "text2.txt" from "sample.zip" WITHOUT EXTRACTING the zip file. ... (4 Replies)
Discussion started by: sridharg
4 Replies

6. Shell Programming and Scripting

Archive Files

I have 15-20 files in a unix folder on daily basis, so i need to archive those 20 files as dated today and place that archived files in a new folder and has to remove those 20 files from that folder. so that i place 20 new files that comes for tomorrow. i need write a unix script to do this. ... (1 Reply)
Discussion started by: gaddamshashank
1 Replies

7. Homework & Coursework Questions

Creating and extracting archive file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi there, I wish to create a single .tar file of the current directory but have literally no idea on where to... (8 Replies)
Discussion started by: Banned
8 Replies

8. UNIX for Advanced & Expert Users

Self extracting archive for Linux and windows

Is there a way to create a self extracting archive that works in both linux and windows? And if so how? Everything I have read on google only works in either Linux or Windows but not both. (6 Replies)
Discussion started by: cokedude
6 Replies

9. UNIX for Dummies Questions & Answers

Cpio archive help

Hi I'm new to the forum and looking for some help with cpio archive creation. I have a bunch of directories that I need to make into a cpio archive. The problem I'm having is that when I input the commands I get the cpio archive but it creates a duplicate of the archive inside the archive... (4 Replies)
Discussion started by: reeves1985
4 Replies

10. Shell Programming and Scripting

Script to archive logs and sftp to another archive server

Requirement: Under fuse application we have placeholders called containers; Every container has their logs under: <container1>/data/log/fuse.log <container1>/data/log/fuse.log.1 <container1>/data/log/fuse.log.XX <container2>/data/log/fuse.log... (6 Replies)
Discussion started by: Arjun Goswami
6 Replies
ARCHIVE_WRITE_FREE(3)					   BSD Library Functions Manual 				     ARCHIVE_WRITE_FREE(3)

NAME
archive_write_fail, archive_write_close, archive_write_finish, archive_write_free -- functions for creating archives LIBRARY
Streaming Archive Library (libarchive, -larchive) SYNOPSIS
#include <archive.h> int archive_write_fail(struct archive *); int archive_write_close(struct archive *); int archive_write_finish(struct archive *); int archive_write_free(struct archive *); DESCRIPTION
archive_write_fail() Always returns ARCHIVE_FATAL. This marks the archive object as being unusable; after calling this function, the only call that can succeed is archive_write_free() to release the resources. This can be used to speed recovery when the archive creation must be aborted. Note that the created archive is likely to be malformed in this case; archive_write_close() Complete the archive and invoke the close callback. archive_write_finish() This is a deprecated synonym for archive_write_free(). archive_write_free() Invokes archive_write_close() if necessary, then releases all resources. If you need detailed information about archive_write_close() failures, you should be careful to call it separately, as you cannot obtain error information after archive_write_free() returns. RETURN VALUES
These functions return ARCHIVE_OK on success, or ARCHIVE_FATAL. ERRORS
Detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions. SEE ALSO
tar(1), libarchive(3), archive_write_set_options(3), cpio(5), mtree(5), tar(5) BSD
February 2, 2012 BSD
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy