[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Multiple 7zip extract





On Sun, Jan 16, 2022, 12:33 PM Nicholas Geovanis <nickgeovanis@gmail.com> wrote:

On Sun, Jan 16, 2022, 11:44 AM Gokan Atmaca <linux.gokan@gmail.com> wrote:
Hello

> $ cd destination-directory-for-extracted-files
> $ find top-directory-of-tree-containing-archive-files -type f -name \*7z -exec 7z e {} \;

I'm already able to import into a single folder with the following. My
problem is extracting 7z files, which are in thousands of folders with
a size of close to 100GB, into their own directories.
 # find /home/z0/ob7z/ -name "*.7z" -type f| xargs -I {} 7z x -p*****
-oextract7z {};

You might need to use the xargs command in a pipe. It batches its arguments so you can handle command strings that exceed the shell's command buffer sizes.

Ok sorry, duh, you're already doing that :-)
So write a 5-line script: Loop thru the fully qualified filenames; take the first part of each non-qualified filename using the shell's file matching operators, make a directory with that name under some parent directory,, then extract to it.

The hardest part will be remembering that you have to set the "+x" flag on the script's file if you want to start it directly :-)

On Sun, Jan 16, 2022 at 8:02 PM David Wright <deblis@lionunicorn.co.uk> wrote:
>
> On Sun 16 Jan 2022 at 18:59:49 (+0300), Gokan Atmaca wrote:
> >
> > I have hundreds of 7z compressed files in different folders. I want to
> > open them. Every extracted file must be in the same directory. How can
> > we do this?
>
> $ cd destination-directory-for-extracted-files
> $ find top-directory-of-tree-containing-archive-files -type f -name \*7z -exec 7z e {} \;
>
> If the archives are not in one tree, but dispersed, you can specify
> multiple directories between "find" and "-type".
>
> Cheers,
> David.
>


Reply to: