Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Processing a list of files

I have a files that contains a list of other files  i.e

MyZipFiles

/home/temp/1.zip
/home/temp/2.zip

How would would a write a script to interate over the files in this list and unzip them. I want pass the the fileName (MyZipFiles) into my script

0
Molko
Asked:
Molko
  • 3
  • 2
1 Solution
 
jmsloanCommented:
this line will llist all file if the filename exist in MyZipFile

for line in `cat MyZipFile`; do  echo $line; done
0
 
MolkoAuthor Commented:
so where you have

do echo $line;

I can have my unzip $line

?
0
 
jmsloanCommented:
for line in `ls *.zip`; do  unzip $line; done
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jmsloanCommented:
Yes assuming you have unzip installed.

If file list is stored in a file
for line in `cat MyZipFile`; do  unzip $line; done

If you want to list all .zip file
for line in `ls *.zip`; do  unzip $line; done
0
 
Kamaraj SubramanianApplication Support AnalystCommented:
while read filename
do
     unzip $filename && echo "$filename unzipped" || echo "Problem in unzipping - $filename"
done < MyZipFiles

Open in new window

0
 
MolkoAuthor Commented:
ta !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now