You are not logged in.

#1 2014-10-01 19:04:27

heldiho53
Member
Registered: 2013-03-14
Posts: 48

Inotify check content in .rar archive and extract to specific folder?

Good evening! I don't know if this is the right section to post this, move it if needed. It was really bugging me that I had to extract each zip, rar, 7z etc manually so I made a script with Inotify, so know it extracts right after the download is finished. My question is now: Is there a command that checks the content of a .rar zip etc archive and then extracts it to a specific folder? If it is a videofile for example extract it in video folder? I'm not pro in shellscripting so please don't be too hard on me.

Offline

#2 2014-10-01 19:41:41

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Inotify check content in .rar archive and extract to specific folder?

You could write a case based on the file extensions and move to a specific specific directory based on matches...


Moving to Programming & Scripting


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-10-01 19:47:31

heldiho53
Member
Registered: 2013-03-14
Posts: 48

Re: Inotify check content in .rar archive and extract to specific folder?

Oh yes I never thought that way and a big facepalm on me of course this thread has to be in programming and scripting. But anyway I will try your suggestion.

Offline

#4 2014-10-01 19:48:30

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Inotify check content in .rar archive and extract to specific folder?

Does each archive need to be kept together? Does each one only contain 1 type of file?

...if you're just wanting to unpack some "freely distributable media content" and put mp3s into one directory mp4 in another (etc), then a simple:

find /tmp/extracted -name '*mp3' -or -name '*flac' -exec mv '{}' /media/music \;

type command after your extract would work

Last edited by stevenhoneyman (2014-10-01 19:49:13)

Offline

Board footer

Powered by FluxBB