10-03-2006
The + tells find to only run it once. It runs it like "tar -cf file.tar file1 file2", which includes both files in one archive, file.tar.
The version without the + runs tar twice, once for each file. tar does not automatically append, it replaces, so it replaces the first archive.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
how to tar to multiple tapes (1 Reply)
Discussion started by: sean dixon
1 Replies
2. UNIX for Advanced & Expert Users
Hi all,
How to untar a file with .tar.tar extension. A utility that i downloaded from net had this extension.
Thanks in advance,
bubeshj. (6 Replies)
Discussion started by: bubeshj
6 Replies
3. Shell Programming and Scripting
so i have hundreds of files named history.20071112.tar
(history.YYYYMMDD.tar)
and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis
here is what i have so far:
for FILE in `cat dirlist`
do
tar xvf $FILE ./status_*
done
dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies
4. BSD
Hello,
I have a little problem with backup & restoring files from tape drive.
I am adding 3 directories to my tape, and it is OK:
hades# tar -cvf /dev/nsa0 test test1 restore
a test
a test/level1
a test/myharddisk.img
a test1
a test1/level1
a test1/myharddisk.img
a test1/test.img
a... (1 Reply)
Discussion started by: d3m00n
1 Replies
5. UNIX for Advanced & Expert Users
Hi,
On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files.
a) /usr/users/oracle/bin
b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
4 files are returned when i issue 'find . -mtime -1 -type f -ls'.
./ora_475244.aud
./ora_671958.aud
./ora_934052.aud
./ora_934050.aud
However, when I issued the below command:
tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I'd like to process multiple files. For example:
file1.txt
file2.txt
file3.txt
Each file contains several lines of data. I want to extract a piece of data and output it to a new file.
file1.txt ----> newfile1.txt
file2.txt ----> newfile2.txt
file3.txt ----> newfile3.txt
Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies
8. Shell Programming and Scripting
Hi all,
I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies
9. Shell Programming and Scripting
#cat a
BAC064DAL
BAC063DAL
BAC056PHX
BAC066DAL
BAC062PHX
BAC062DAL
BAC060DAL
BAC058PHX
BAC054PHX
BAC051PHX
# for i in `cat a`
> do
> tar xvf $a/$a*.tar*
> done
tar: /*.tar*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: /*.tar*: Cannot... (3 Replies)
Discussion started by: kenshinhimura
3 Replies
10. Shell Programming and Scripting
i extract it through script, is there any way to script or automate to tar extract a tarfiles in multiple directories at once?
Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
for dir in `ls -d /tarfiles/*/ | sed 's/.$//'`
do
rm -f $dir/*.tar
mv -f... (1 Reply)
Discussion started by: kenshinhimura
1 Replies
LEARN ABOUT PHP
phardata.extractto
PHARDATA.EXTRACTTO(3) 1 PHARDATA.EXTRACTTO(3)
PharData::extractTo - Extract the contents of a tar/zip archive to a directory
SYNOPSIS
bool PharData::extractTo (string $pathto, [string|array $files], [bool $overwrite = false])
DESCRIPTION
Extract all files within a tar/zip archive to disk. Extracted files and directories preserve permissions as stored in the archive. The
optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The sec-
ond parameter files can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By
default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method
is similar to ZipArchive.extractTo(3).
PARAMETERS
o $pathto
- Path to extract the given files to
o $files
- The name of a file or directory to extract, or an array of files/directories to extract
o $overwrite
- Set to TRUE to enable overwriting existing files
RETURN VALUES
returns TRUE on success, but it is better to check for thrown exception, and assume success if none is thrown.
ERRORS
/EXCEPTIONS
Throws PharException if errors occur while flushing changes to disk.
EXAMPLES
Example #1
A PharData.extractTo(3) example
<?php
try {
$phar = new PharData('myphar.tar');
$phar->extractTo('/full/path'); // extract all files
$phar->extractTo('/another/path', 'file.txt'); // extract only file.txt
$phar->extractTo('/this/path',
array('file1.txt', 'file2.txt')); // extract 2 files only
$phar->extractTo('/third/path', null, true); // extract all files, and overwrite
} catch (Exception $e) {
// handle errors
}
?>
SEE ALSO
Phar.extractTo(3).
PHP Documentation Group PHARDATA.EXTRACTTO(3)