Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #244054 > unrolled thread
| Started by | Gokan Atmaca <linux.gokan@gmail.com> |
|---|---|
| First post | 2022-01-16 17:10 +0100 |
| Last post | 2022-01-16 22:40 +0100 |
| Articles | 10 — 5 participants |
Back to article view | Back to linux.debian.user
Multiple 7zip extract Gokan Atmaca <linux.gokan@gmail.com> - 2022-01-16 17:10 +0100
Re: Multiple 7zip extract Andrei POPESCU <andreimpopescu@gmail.com> - 2022-01-16 17:40 +0100
Re: Multiple 7zip extract David Wright <deblis@lionunicorn.co.uk> - 2022-01-16 18:10 +0100
Re: Multiple 7zip extract Gokan Atmaca <linux.gokan@gmail.com> - 2022-01-16 18:50 +0100
Re: Multiple 7zip extract Nicholas Geovanis <nickgeovanis@gmail.com> - 2022-01-16 19:40 +0100
Re: Multiple 7zip extract Nicholas Geovanis <nickgeovanis@gmail.com> - 2022-01-16 19:50 +0100
Re: Multiple 7zip extract Gokan Atmaca <linux.gokan@gmail.com> - 2022-01-16 21:30 +0100
Re: Multiple 7zip extract Andrei POPESCU <andreimpopescu@gmail.com> - 2022-01-16 20:00 +0100
Re: Multiple 7zip extract David Wright <deblis@lionunicorn.co.uk> - 2022-01-16 21:50 +0100
Re: Multiple 7zip extract Greg Wooledge <greg@wooledge.org> - 2022-01-16 22:40 +0100
| From | Gokan Atmaca <linux.gokan@gmail.com> |
|---|---|
| Date | 2022-01-16 17:10 +0100 |
| Subject | Multiple 7zip extract |
| Message-ID | <DGggr-4Aj-25@gated-at.bofh.it> |
Hello 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? Thanks. -- ⢀⣴⠾⠻⢶⣦⠀ ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org ⠈⠳⣄⠀⠀⠀⠀
[toc] | [next] | [standalone]
| From | Andrei POPESCU <andreimpopescu@gmail.com> |
|---|---|
| Date | 2022-01-16 17:40 +0100 |
| Message-ID | <DGgJr-4JE-1@gated-at.bofh.it> |
| In reply to | #244054 |
[Multipart message — attachments visible in raw view] — view raw
On Du, 16 ian 22, 18:59:49, Gokan Atmaca wrote: > Hello > > 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? If I understand your question correctly `find` with the `-execdir` action should do what you want. See the manpage for details. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser
[toc] | [prev] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2022-01-16 18:10 +0100 |
| Message-ID | <DGhct-594-7@gated-at.bofh.it> |
| In reply to | #244054 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Gokan Atmaca <linux.gokan@gmail.com> |
|---|---|
| Date | 2022-01-16 18:50 +0100 |
| Message-ID | <DGhPb-5nm-3@gated-at.bofh.it> |
| In reply to | #244059 |
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 {};
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.
>
[toc] | [prev] | [next] | [standalone]
| From | Nicholas Geovanis <nickgeovanis@gmail.com> |
|---|---|
| Date | 2022-01-16 19:40 +0100 |
| Message-ID | <DGiBz-5Yx-1@gated-at.bofh.it> |
| In reply to | #244063 |
[Multipart message — attachments visible in raw view] — view raw
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.
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.
> >
>
>
[toc] | [prev] | [next] | [standalone]
| From | Nicholas Geovanis <nickgeovanis@gmail.com> |
|---|---|
| Date | 2022-01-16 19:50 +0100 |
| Message-ID | <DGiLf-63n-1@gated-at.bofh.it> |
| In reply to | #244064 |
[Multipart message — attachments visible in raw view] — view raw
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.
>> >
>>
>>
[toc] | [prev] | [next] | [standalone]
| From | Gokan Atmaca <linux.gokan@gmail.com> |
|---|---|
| Date | 2022-01-16 21:30 +0100 |
| Message-ID | <DGkk1-75G-3@gated-at.bofh.it> |
| In reply to | #244066 |
> 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.
You're absolutely right, but I don't have time. :) I'll take care of
it during the week.
Thank you for your interest.
On Sun, Jan 16, 2022 at 9:42 PM Nicholas Geovanis
<nickgeovanis@gmail.com> wrote:
>
>
>
> 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.
>>> >
>>>
[toc] | [prev] | [next] | [standalone]
| From | Andrei POPESCU <andreimpopescu@gmail.com> |
|---|---|
| Date | 2022-01-16 20:00 +0100 |
| Message-ID | <DGiUW-66Y-11@gated-at.bofh.it> |
| In reply to | #244063 |
[Multipart message — attachments visible in raw view] — view raw
On Du, 16 ian 22, 20:44:12, Gokan Atmaca 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 {};
And -execdir is not suitable because... ?
By the way, using '{} +' instead of '{} ;' is the same as using xargs.
Kind regards,
Andrei
--
http://wiki.debian.org/FAQsFromDebianUser
[toc] | [prev] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2022-01-16 21:50 +0100 |
| Message-ID | <DGkDo-7dU-7@gated-at.bofh.it> |
| In reply to | #244063 |
On Sun 16 Jan 2022 at 20:44:12 (+0300), Gokan Atmaca wrote:
> On Sun, Jan 16, 2022 at 8:02 PM David Wright 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".
>
> 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 obviously meant something else by "Every extracted file must be in
the same directory" from the literal meaning that I employed. And as
I don't use 7z myself, preferring infozip, I ignored efficiency, and
any use of xargs or switches¹, in favour of clarity.
"My problem is extracting 7z files … into their own directories."
I can't parse this either. Do the files in the archives all fit
into their own tree of directories, separate from the tree containing
all the archives? Or do the files in each archive have to be placed
in a single directory corresponding to that archive? Or in an
individual tree of directories, whose root corresponds to that archive?
And a minor point: is using "folder"/"directory" significant to you?
I assume that others haved guessed their answer to that, though
I haven't seen any specific code posted apart from the above.
¹ though obviously you can't avoid -psecret.
Cheers,
David.
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2022-01-16 22:40 +0100 |
| Message-ID | <DGlpM-7Rr-3@gated-at.bofh.it> |
| In reply to | #244076 |
On Sun, Jan 16, 2022 at 02:48:00PM -0600, David Wright wrote:
> You obviously meant something else by "Every extracted file must be in
> the same directory" from the literal meaning that I employed.
Yes, the wording is quite ambiguous.
> "My problem is extracting 7z files … into their own directories."
>
> I can't parse this either.
The original request has at least three possible interpretations.
Let's assume that they've got a directory structure like this:
TOPLEVEL/dir1
/dir2
/sub1
/sub2
/dir3
So, there are 5 directories (not counting TOPLEVEL): 3 at depth 1 below
TOPLEVEL, and 2 at depth 2 below TOPLEVEL. Let's assume there are *.7z
files in all 5 of these directories.
The first interpretation is "I want all of the extracted files in TOPLEVEL".
That's how I read it at first. That's the interpretation which leads to
all of the output files being in the same directory, after all.
The second interpretation is "I want the extracted files from
TOPLEVEL/dir1/foo.7z to be in TOPLEVEL/dir1, and the extracted files from
TOPLEVEL/dir2/sub1/bar.7z to be in TOPLEVEL/dir2/sub1, and so on."
Given the second quoted statement above, I believe they want the second
interpretation.
A lot of responders in this thread seemed to assume that from the outset,
hence the suggestions involving -execdir, which only makes sense under
the second interpretation.
For the record, given the second interpretation, I agree that find -execdir
is a perfect fit.
Now, there's at least a third possible interpretation. It's possible that
given the source file TOPLEVEL/dir2/sub2/baz.7z, they would like to create
the depth 3 directory TOPLEVEL/dir2/sub2/baz and then extract baz.7z into
that new directory.
There could be other valid interpretations as well. The only way we'll
ever know for sure what the OP wants is if the OP gives an actual example,
with pathnames. Ideally the real pathnames, but we all know that won't
happen....
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web