LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-21-2012, 08:16 PM   #1
captainsixxx
LQ Newbie
 
Registered: Jan 2012
Location: Washington State
Distribution: Ubuntu 11.10 (64bit) / Linux Mint 12 (32bit)
Posts: 2

Rep: Reputation: Disabled
Question Extracting "rar" in multiple sub folders at once in ubuntu 11.10


i already can right click and "extract here", what i am looking to do is right click on a folder and have it extract (within each sub-folder) extract all, example i have folder "A" and it contains folders 1-5, each folder contains its own set ov "rars" that would result in their own files, however, it is very time consuming to extract each sub folder by itself, is there some way to do this using GUI desktop, for i am no good with terminal..

and as far as trying to write any "bash" or other command lines, is like being 6 years old and trying to master brain surgery..
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-21-2012, 08:46 PM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 191Reputation: 191
There is possibly a GUI "batch" unrar application, although I cant say for certain, since I use the commandline for this sort of thing.

Frankly, learning the basics of the command line, is a hundred fold more useful for this type of work, as it is a lot more flexible.
ie: a batch unrar GUI application will only handle batch extracting of archives, where the same thing in a command line, can be adapted to do any just about anything.
Code:
$ find . -name "*.rar" -exec unrar x '{}' \;
Making sure that you change directories to the directory that contains the rar files and relevant subdirs, otherwise the command will work from the current directory. ie: if you run it from /home/username, it will extract ALL rar files anywhere in your home directory, which could create a mess rather quickly.


Let me explain what this does.
"find ." - will find files within the current directory and any subdirectories
"-name "*.rar" - will only find *.rar files
"-exec " - will perform an external command on the results found by the "find" command.
"unrar x" - is the command to extract the rar archives
"'{}'" - tells find to append the found result to the end of the exec'd command.
"\;" - signifies the end of the exec'd command.

After extracting the archives, you could then change the "unrar -x", to "rm -f" and run it again to remove the source archives, leaving you only with the contents of the original archives.

There are a number of other ways to do this, but using "find" is often the simplest, and is a simple "one liner", no scripting as such involved.
 
3 members found this post helpful.
Old 01-21-2012, 08:46 PM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Doing this in the GUI may not be entirely possible.

If you care to open up a terminal, use the "cd" command to change into directory "A" (as you described), then you can issue the following command:
Code:
$ for subdir in 1 2 3 4 5
> do
>  cd $subdir
>  for rarfile in $(ls *.rar)
>  do
>   rar e $rarfile
>  done
> done

Last edited by indienick; 01-21-2012 at 08:48 PM.
 
1 members found this post helpful.
Old 01-22-2012, 01:32 PM   #4
captainsixxx
LQ Newbie
 
Registered: Jan 2012
Location: Washington State
Distribution: Ubuntu 11.10 (64bit) / Linux Mint 12 (32bit)
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thumbs up

thank you both for you help, it seams that i have no choice but to start learning (or attempting) to use this code and bash and terminal,

I am not sure if this is solved, but i at least know what i need to be trying to do to solve my needs.. thanks again..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
".config" and ".kde" folders are being created under root directory (Slack Current) piratesmack Slackware 8 03-12-2011 11:06 PM
readdir() gives "." and ".." and doesn't exclude some folders Tordne Programming 12 08-13-2009 03:01 PM
How might I restore kmail folders/mail/settings from a "badly" saved "home"? deh6 Linux - Software 5 03-08-2008 09:25 PM
How do you create shortcuts to "folders" and "binaries" in GNOME? ebenh Linux - Desktop 5 01-21-2008 05:28 AM
Displaying "Subscribed Threads" -> new folder "All Folders" JZL240I-U LQ Suggestions & Feedback 5 06-15-2007 06:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 07:19 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration