Unzip ISO file

Want something added? Ask for it here.

Unzip ISO file

Postby mark1979smith » July 15th, 2012, 11:48 am

Would it be possible to unzip an ISO file automatically, possible as an option?

Thanks

Mark
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Re: Unzip ISO file

Postby sander » July 15th, 2012, 11:58 am

An ISO image is uncompressed (see http://en.wikipedia.org/wiki/ISO_image ) and can thus not be unzipped.

Maybe you mean mounting or opening the ISO-file? If your OS (you did not specify which OS you use: Linux, Unix, OSX, Windows, ...) has a command line tool to mount/open a ISO image, you could write a script that does the ISO image mounting / opening.
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby mark1979smith » July 15th, 2012, 12:09 pm

Hi,

Thanks for the quick reply.

Sorry for the confusion, I use 7-zip to extract the files out of an iso and thought it would be nice if that step could be done automatically. Although I do understand not everyone would want ISO's extracted.

Not sure what my OS is as it's installed on a Synology Diskstation DS410j.

Mark
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Re: Unzip ISO file

Postby sander » July 15th, 2012, 12:19 pm

7-zip can extra an ISO image? Cool!

You're Synology probably runs some Unix. First step to create a script, is to find the command line to extract the ISO-image on your Synology. So: can you login (SSH) on the Synology? If so, can you create the command line?

Wait: 7-zip ... that's on your Synology, right?
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby mark1979smith » July 15th, 2012, 12:24 pm

Hi,

Yeah, I love 7-zip :)

I can log on to the diskstation through SSH. I get "BusyBox v1.16.1 (2012-05-10 02:27:56 CST) built-in shell (ash) Enter 'help' for a list of built-in commands." when I log in.

7-zip is not on the diskstation, I extract it through Windows on my PC (hence the reason for this request) as it constantly downloading and uploading at 10MB. Obviously it would be quicker done without the network restrictions.

Mark
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Re: Unzip ISO file

Postby sander » July 15th, 2012, 12:31 pm

OK. So with Synology-commands. But first: do you want to create a script?

EDIT:

My Ubuntu Linux has "7z". With

Code: Select all
7z x <blabla.ISO>


I'm able to extract an ISO file.

So:
- thanks for the 7z / ISO tip
- does your Synology have 7z installed or installable?
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby mark1979smith » July 15th, 2012, 12:49 pm

OMG!!

It works, it turns out 7-zip is installed and works as simply as that!

Now, I assume I need to create a script which scans the folders for an ISO folder and if it's found execute that command.

As an overhead point of view, I don't want to scan all the folders in the download directory for an ISO image, is it possible to just scan the current download folder?

Mark
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Re: Unzip ISO file

Postby sander » July 15th, 2012, 1:52 pm

Cool.

Read http://wiki.sabnzbd.org/user-scripts for some info on scripts.
Have you ever used a post-processing script? You should first get an existing script working.


The ISO extract script could be something like

Code: Select all
cd $1
7z x *.iso
7z x *.ISO


That will extract an *.iso and *.ISO in the download directory, but not in subdirectories. If you want to scan sub-dirs too, add "7x */*.iso" etc.

You can always run this script, as it won't do any harm when there is no ISO. ;-)

HTH
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby mark1979smith » July 15th, 2012, 2:30 pm

Thanks for the info.

I haven't created any scripts in the past. It's not clear what type of file to create, is it a plain text file (extract_iso.txt) or does it need to have a particular extension (such as .sh)

Many Thanks

Mark
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Re: Unzip ISO file

Postby sander » July 15th, 2012, 2:37 pm

It's best to create a script named "7z-iso-extract.sh", with these contents:

Code: Select all
cd $1
7z x *.iso
7z x *.ISO


Then you have to set the x-bit on the script:

Code: Select all
chmod a+x 7z-iso-extract.sh


After that you can test the script from the Synology command line. For example:

Code: Select all
/home/synology/7z-iso-extract.sh /home/synology/Downloads/complete/MyDownload1


Of course this is an example; you have to change to your directories ...
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby sander » July 15th, 2012, 2:47 pm

Update: tested on my Ubunut Linux:

Script (EDITed):
Code: Select all
#!/bin/sh

cd "$1"
mkdir unpack
cd unpack
# pwd

7z x ../*.iso
7z x ../*.ISO

7z x ../*/*.iso
7z x ../*/*.ISO




Command:
Code: Select all
/home/sander/scripts-voor-SAB/7z-iso-extract.sh "/home/sander/Downloads/complete/Ubuntu 11_04 desktop amd64 Natty Narwhal amd64/"


Tested from the command line ... and it works. Please note: still no SABnzbd involved! Just everything from the command line.

Next step:
I'm now testing it from SABnzbd with an actual ISO download.

EDIT: after some improvements, the scripts works great.

So ... there you go!
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby exussum » July 15th, 2012, 4:01 pm

how about

$ find / -maxdepth 3 -iname '*.iso' -exec 7z x {\}\ \;

Should work as well - change the maxdepth to however far you want to go
exussum
Jr. Member
Jr. Member
 
Posts: 79
Joined: November 18th, 2010, 3:51 am

Re: Unzip ISO file

Postby mark1979smith » July 15th, 2012, 4:17 pm

Thanks very much for all the assistance.

Mark
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Re: Unzip ISO file

Postby sander » July 15th, 2012, 5:02 pm

mark1979smith wrote:Thanks very much for all the assistance.

Mark


Everything OK? Or are you overwhelmed by this information?
User avatar
sander
Release Testers
Release Testers
 
Posts: 3482
Joined: January 22nd, 2008, 3:22 pm

Re: Unzip ISO file

Postby mark1979smith » July 16th, 2012, 2:32 am

sander wrote:
mark1979smith wrote:Thanks very much for all the assistance.

Mark


Everything OK? Or are you overwhelmed by this information?


Yes, everything is fine. It's working 100%.

My only bugbear is that I have select 'extract_iso.sh' from the scripts dropdown list for each download. Is there a way around this?
mark1979smith
Newbie
Newbie
 
Posts: 11
Joined: July 14th, 2012, 7:51 am

Next

Return to Feature Requests