On Thu, Mar 15, 2007 at 02:59:01AM EST, Adam Porter wrote: > I've read the man page, googled this list and the rest of the Net, but I > still can't figure out why this doesn't work: > > $ tar xjf *.tar.bz2 > tar: beryl-core-0.2.0.tar.bz2: Not found in archive > tar: beryl-manager-0.2.0.tar.bz2: Not found in archive > tar: beryl-plugins-0.2.0.tar.bz2: Not found in archive > tar: beryl-plugins-unsupported-0.2.0.tar.bz2: Not found in archive > tar: beryl-settings-0.2.0.tar.bz2: Not found in archive > tar: beryl-settings-bindings-0.2.0.tar.bz2: Not found in archive > tar: beryl-settings-simple-0.2.0.tar.bz2: Not found in archive > tar: emerald-0.2.0.tar.bz2: Not found in archive > tar: emerald-themes-0.2.0.tar.bz2: Not found in archive > tar: heliodor-0.2.0.tar.bz2: Not found in archive > tar: Error exit delayed from previous errors > > Not only did it completely fail, but it skipped the first file in the > directory, aquamarine-0.2.0.tar.bz2. But if I run the same command on a > single file instead of a wildcard, it works fine. > > Am I doing something wrong? Why can't tar handle a wildcard list like that?
compare .. $ tar xjf a.tar.bz2 # extract all files $ tar xjf a.tar.bz2 f1.txt f2.txt # extract f1.txt & f2.txt $ tar xjf a.tar.bz2 *.txt # extract list of *.txt files (1) $ tar xjf a.tar.bz2 '*.txt' # extract files matching *.txt (2) Note that in (1) the shell expands the unquoted *.txt to the list of files in the current directory that match *.txt and passes this list to tar .. while in (2) the shell does not "see" the wild card and passes the *.txt pattern to tar without expanding it. So in your above scenario, it does not "skip" the first file .. The shell expands the *.tar.bz2 pattern to aquamarine, beryl-core, beryl-manager .. and tar looks in aquamarine for files beryl-core .. beryl-manager .. etc. and naturally does not find them in the archive. I rarely need to extract the entire contents of several tar archives in one pass but something like this should work: $ for t in $(ls *.tar.bz2); do tar xjf $t; done Note that, to avoid file system pollution it is probably a good idea to get into the habit of verifying what your extraction commands exactly do by first issuing a "tar tjvf" and reviewing the output. HTH Thanks, cga -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]