Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 18 Dec 2014, 09:37
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Need script to extract rar, zip and 7z files
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
enhu


Joined: 26 May 2009
Posts: 301

PostPosted: Wed 08 Sep 2010, 07:35    Post_subject:  Need script to extract rar, zip and 7z files  

can you help me with this please. tryingto create a script that will extract rar. zip and 7z files after it is downloaded to a particular folder.

something like this but not sure if it will work Very Happy


Code:

if [ -e *.rar *.zip *.7z ]
then
   unrar x *.rar /path/%d
fi
Back to top
View user's profile Send_private_message Visit_website 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Wed 08 Sep 2010, 11:00    Post_subject:  

Dear enhu,

Good information here http://www.debianadmin.com/howto-crack-rar-7z-and-zip-files-in-linux.html.

Quote:
If you want to unrar a list of files, you could use this command. You don’t necessarily need the quotes, but it helps when the filenames have spaces or something like that in them.

for f in *.rar;do unrar e “$f”;done

If you wanted to use 7zip to extract a list of files:

for f in *.001;do 7z e “$f”;done

Or if you wanted to unzip a list of files:

for f in *.zip;do unzip “$f”;done

You could even chain commands together if you wanted to. For instance, if all your zip files contained .txt files and you wanted to unzip them and then move the unzipped files to another directory:

for f in *.zip;do unzip “$f”;done; for f in *.txt;do mv “$f” /myfolder/;done

The bash shell is just so incredibly powerful… this doesn’t even tap the power, but it should give you a good idea of what is possible.


With kind regards,
vovchik
Back to top
View user's profile Send_private_message 
abushcrafter


Joined: 30 Oct 2009
Posts: 1447
Location: England

PostPosted: Fri 12 Nov 2010, 08:14    Post_subject:  

You might love this: http://www.murga-linux.com/puppy/viewtopic.php?p=432627#432627
_________________
adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
Back to top
View user's profile Send_private_message Visit_website 
jyore


Joined: 06 Nov 2010
Posts: 43

PostPosted: Sat 13 Nov 2010, 20:59    Post_subject:  

You could look into python as well. I've used it to automagically extract, replace/edit files, rearchive, and also recalculate the md5. Should be plenty of info on the google, and/or the python website. Should require only a few libraries, most of which, are likely standard python libraries.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0496s ][ Queries: 12 (0.0076s) ][ GZIP on ]