Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Uncompress several tar.gz files inside several folders

Tags
loop shell bash while, sheel script, shell scripts, tar.gz

Login to Reply

 
Thread Tools Search this Thread
# 8  
Old 07-12-2018
Please use code tags as required by rules.
Other then that, you still haven't provided your shell and operating system version.

Nobody expects you to write a 1000 names in a script.
That is why we have computers

But you can probably match them with a regular expression.

We cannot help you form one, if you do not provide representative example of the directory list.

Output in french language also obfuscates things a bit.

Regards
Peasant.

Last edited by Peasant; 07-12-2018 at 10:24 AM.. Reason: Addition.
# 9  
Old 07-12-2018
Without fully understanding what going on here, the first thing to do would be drop the double quotes around $liste_rep in the first for loop, and replace $liste_rep with $rep in the second. Try that and report back.
The Following User Says Thank You to RudiC For This Useful Post:
shellX (07-12-2018)
# 10  
Old 07-12-2018
Sorry

---------- Post updated at 06:40 PM ---------- Previous update was at 06:35 PM ----------

Finally I found out the solution, Thank you Rudic


Code:
#!/bin/bash liste_rep=folder/* 
    echo "LISTE REP :" $liste_rep 
    for rep in $liste_rep 
##$liste_rep without "" double quotes
    do 
              echo "AFFICHE REP :"$rep 
              for fichier in $rep/*.tar.gz 
### use $rep instead of $liste_rep > varibale $liste_rep just list all folders  
### $rep shows folder/001 ... 003 
              do 
                   echo "FICHIER :" $fichier 
### $fichier shows complete path to tar.gz files in each sub-folder 
                   tar -zxvf $fichier --directory $rep/ 
### -- directory uncompress inside -> $rep = folder/001 with '/' so folder/001/...003/ 
             done 
    done 
exit

Moderator's Comments:
Uncompress several tar.gz files inside several folders Please use CODE tags as required by forum rules!

Last edited by shellX; 07-13-2018 at 03:54 AM.. Reason: Added CODE tags.
The Following 2 Users Say Thank You to shellX For This Useful Post:
Corona688 (07-12-2018), rbatte1 (07-13-2018)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to copy files/folders and show the files/folders? Imre Shell Programming and Scripting 6 10-24-2016 08:16 AM
How to delete all the files and folders inside all the directories except some specific directory? Little Shell Programming and Scripting 7 07-29-2015 06:02 PM
Editing all files inside folders and updating pos 88-94 with continuous numbering. lancesunny Shell Programming and Scripting 6 12-11-2012 02:55 PM
Listing folders that have a file inside them KakersUK Shell Programming and Scripting 6 09-14-2012 10:13 AM
Searching for folders/parent folders not files. Aussiemick UNIX for Dummies Questions & Answers 2 06-23-2011 10:56 PM
uncompress tar.gz files gaddamshashank Shell Programming and Scripting 5 07-08-2010 12:04 PM
uncompress a group of files ali560045 Shell Programming and Scripting 8 09-05-2008 02:02 AM
Listing uncompress and compress files laknar Shell Programming and Scripting 1 05-05-2008 04:08 PM
uncompress files diegoe UNIX for Dummies Questions & Answers 3 09-23-2003 12:29 PM
uncompress pkzip files Wing m. Cheng UNIX for Dummies Questions & Answers 2 10-23-2001 02:06 AM


All times are GMT -4. The time now is 08:32 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password