×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Shell Programming and Scripting

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, tar.gz

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #8  
Old 4 Days Ago
Peasant's Unix or Linux Image
Peasant Peasant is offline Forum Advisor  
Registered User
 
Join Date: Mar 2011
Last Activity: 16 July 2018, 8:19 AM EDT
Posts: 1,196
Thanks: 33
Thanked 368 Times in 317 Posts
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; 4 Days Ago at 10:24 AM.. Reason: Addition.
Sponsored Links
    #9  
Old 4 Days Ago
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 16 July 2018, 3:32 PM EDT
Location: Aachen, Germany
Posts: 13,062
Thanks: 447
Thanked 4,011 Times in 3,688 Posts
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 (4 Days Ago)
Sponsored Links
    #10  
Old 4 Days Ago
shellX shellX is offline
Registered User
 
Join Date: Jul 2018
Last Activity: 13 July 2018, 3:54 AM EDT
Location: Paris - France
Posts: 5
Thanks: 1
Thanked 2 Times in 1 Post
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; 3 Days Ago at 03:54 AM.. Reason: Added CODE tags.
The Following 2 Users Say Thank You to shellX For This Useful Post:
Corona688 (4 Days Ago), rbatte1 (3 Days Ago)
Sponsored Links
👤 Login to reply

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 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
How to tar files inside a script? rogerben Shell Programming and Scripting 9 08-02-2012 03:18 PM
uncompress tar.gz files gaddamshashank Shell Programming and Scripting 5 07-08-2010 12:04 PM
Cannot uncompress the tar.gz sbox Solaris 2 02-08-2010 02:48 AM



All times are GMT -4. The time now is 04:12 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.