Skip site navigation (1)Skip section navigation (2)
Date:      21 Mar 2022 16:58:45 -0400
From:      "John R. Levine" <johnl@iecc.com>
To:        "Ernie Luzar" <luzar722@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Replacement for unzip of .7z compressed files.
Message-ID:  <c8c5d7d2-7013-ea15-f996-6855ee0a66e3@iecc.com>
In-Reply-To: <6238E3DA.4090306@gmail.com>
References:  <20220321201919.925363984C21@ary.qy> <6238E3DA.4090306@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Problem is how do I get the extracted file into a different directory?
> I have a directory named DL with 5 different named .7z files and want to have 
> the unzipped version go to another directory named UZ with the 5 .7z files 
> having the same file names minus the .7z extension.

for f in DL/*.7z
do
  tar -x -C UZ -f $f
done

or maybe

for f in DL/*.7z
do
  tar -x -f $f -O > UZ/$(basename $f .7z)
done

If you want to rename the extracted file ths -s flag might do the trick.

Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c8c5d7d2-7013-ea15-f996-6855ee0a66e3>