You are not logged in.

#1 2024-02-03 20:31:39

rado84
Banned
From: Sofia, Bulgaria
Registered: 2019-05-12
Posts: 135

[SOLVED] Script to extract all 7z files in a dir named after each file

I modified one of my scripts (originally it converts mka to ac3) to extract all 7z files in a directory with the same name as each 7z archive but for some reason it doesn't work.

This is the script after my modification:

#!/usr/bin/env bash

for name in *.7z; 
do 
    newname=$(echo "$name" | rev | cut -f 2- -d '.' | rev)
    7z x "$name" "$newname/" -mmt=8;
done

When executed, it shows some info in terminal and ends pretty quickly without creating the directories which in my POV means it doesn't work. This is what the terminal displays:

Extracting archive: Writing The Future.7z
--
Path = Writing The Future.7z
Type = 7z
Physical Size = 12371317
Headers Size = 192
Method = LZMA2:12m
Solid = +
Blocks = 1


No files to process
Everything is Ok

Files: 0
Size:       0

What am I missing here?

Last edited by rado84 (2024-02-04 08:09:47)


Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM

Offline

#2 2024-02-04 08:09:33

rado84
Banned
From: Sofia, Bulgaria
Registered: 2019-05-12
Posts: 135

Re: [SOLVED] Script to extract all 7z files in a dir named after each file

I made it work:

7z e -y "$name" -o"$newname/"

You can delete the topic.


Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM

Offline

#3 2024-02-04 09:53:26

ayekat
Member
Registered: 2011-01-17
Posts: 1,592

Re: [SOLVED] Script to extract all 7z files in a dir named after each file

rad84 wrote:

You can delete the topic.

We don't do that here.
https://wiki.archlinux.org/title/Genera … way_street


pkgshackscfgblag

Offline

Board footer

Powered by FluxBB