LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-28-2014, 01:51 PM   #1
Tealk144
LQ Newbie
 
Registered: Feb 2012
Posts: 8

Rep: Reputation: Disabled
Shell Script Archive entpacken


Hi erstmal, ich suche nach einer Möglichkeit wie ich einem Shell script sagen kann er soll in einem Ordner mehrere Archive entpacken.
Ist dies möglich denn ich kann dem Script keine festen Namen der Archive geben, weil dort Versionsnummern mit hinterlegt sind.
 
Old 06-28-2014, 01:52 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,705

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by Tealk144 View Post
Hi erstmal, ich suche nach einer Möglichkeit wie ich einem Shell script sagen kann er soll in einem Ordner mehrere Archive entpacken.
Ist dies möglich denn ich kann dem Script keine festen Namen der Archive geben, weil dort Versionsnummern mit hinterlegt sind.
Please read the LQ Rules: this is an English only forum, so please repost your question in English.

Last edited by TB0ne; 06-28-2014 at 01:53 PM.
 
Old 06-28-2014, 03:04 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
hallo tealk144, wenn deine englischkenntnisse nicht so gut sind kannst du mir eine private message senden, wir versuchen dass dann abzuklären. hört sich nicht so kompliziert an. haben alle archive die gleiche dateiendung? pack mal eine dateiliste mit ein.
gruss, o.

translation:
hallo tealk144 if yours are not so good english you can send me private message, we try to clarify that then. does not sound so elaborately. do everything have archive same ending? pack sometimes file list with.


in other words, we will either continue this in english or op can pm me.
 
Old 06-28-2014, 04:55 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
OP can't PM you. PMs are only available for members with more than 150 posts.

@Tealk144: If you need help with translations feel free to send me a mail.
 
Old 06-29-2014, 11:18 AM   #5
Tealk144
LQ Newbie
 
Registered: Feb 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hmm ok, yes i have some problems to explain something in English^^
i cant give you a List with the Files, but all Files are .zip like "worldedit-5.6.2.zip"
 
Old 06-29-2014, 12:06 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Do you want to extract all the archives in that specific directory or only specific ones?
If you want to extract them all something like this will do:
Code:
 for i in *
do
    unzip $i
done
 
1 members found this post helpful.
Old 06-29-2014, 12:11 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
shell oneliner:
Code:
for f in *.zip ; do unzip -d $f.unzipped $f ; done
you can paste that straight into your terminal (change to the folder with the zip files first).


or, as a script:
Code:
#!/bin/sh
for f in *.zip
  do 
    unzip -d $f.unzipped $f
  done
you can save that to a file, then make that file executable, then execute it.
it might be good to put the file in $HOME/bin and make sure that $HOME/bin is in your $PATH.
you could then point your file browser to some custom "Open with..." command for zip-files.

edit: hrmph, some forum guru beat me to it again.

Last edited by ondoho; 06-29-2014 at 12:16 PM.
 
1 members found this post helpful.
Old 06-29-2014, 02:47 PM   #8
Tealk144
LQ Newbie
 
Registered: Feb 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
how i check that in that folder are zip files?
 
Old 06-29-2014, 04:51 PM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i don't understand.
you yourself said that they are zip files, all in one folder.
if you run the script on a folder without zipfiles, it simply does not do anything.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script how to remove absolute paths from zip archive hi_irf Linux - Newbie 1 10-03-2009 05:59 AM
How about a shell script archive? Autocross.US LQ Suggestions & Feedback 2 12-05-2006 06:36 PM
shell script - add file to archive ? xconspirisist Linux - Software 2 03-20-2004 03:27 PM
Two Questions: c shell and archive file MisterT Linux - Newbie 3 05-13-2003 03:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration