How to extract all files on a directory and delete all files?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to extract all files on a directory and delete all files?
Hi, I download a lot of scene releases and they all come on rar files. Example: downloading an entire season of a tv show. The download is something like this:
Best.TV.Show.Ever.S01 (main directory)
->Best.TV.Show.Ever.S01E01 (sub-directory)
->Best.TV.Show.Ever.S01E02 (sub-directory)
->Best.TV.Show.Ever.S01E03 (sub-directory)
->Best.TV.Show.Ever.S01E04 (sub-directory)
->Best.TV.Show.Ever.S01E05 (sub-directory)
->Best.TV.Show.Ever.S01E06 (sub-directory)
Currently, I navigate through all directories and extract the episodes one by one. Then, I watch the episode and delete the files. Is there an easy way to extract all files and remove them automatically? Extracting one by one manually can be pretty boring and annoying. Thanks and sorry for my bad english.
Last edited by moisespedro; 01-19-2014 at 08:34 AM.
Sorry to not have replied earlier; been traveling.
Glad it worked. To keep the directories, just take out the line that reads
Code:
rmdir $DIR
As for your worry that it would have excluded files, I'm assuming perhaps you were concerned by the "-type d". That option tells the find command to list directories (as opposed to all files). The lines output from the find command are then sequentially assigned to DIR for the execution of the for loop.
Thanks for the help What I was asking is that even if I don't remove the directories all the files are extracted to the main folder (instead of their respective folders). I used to use RARZombie for that (a java applet but, even know it is a java app, I can't get it working - it runs but it doesn't extract).
EDIT: nevermind, just had to replace "e" (to extract to the current folder) for "x" (to keep the full path). Thread is solved, many thanks
EDIT2: Actually it didn't work
Last edited by moisespedro; 01-19-2014 at 08:33 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.