Unzip ISO file

Want something added? Ask for it here.
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Unzip ISO file

Post by mark1979smith »

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

Thanks

Mark
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

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.
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Re: Unzip ISO file

Post by mark1979smith »

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
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

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?
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Re: Unzip ISO file

Post by mark1979smith »

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
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

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?
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Re: Unzip ISO file

Post by mark1979smith »

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
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

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
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Re: Unzip ISO file

Post by mark1979smith »

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
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

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: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

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!
exussum
Jr. Member
Jr. Member
Posts: 79
Joined: November 18th, 2010, 2:51 am

Re: Unzip ISO file

Post by exussum »

how about

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

Should work as well - change the maxdepth to however far you want to go
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Re: Unzip ISO file

Post by mark1979smith »

Thanks very much for all the assistance.

Mark
User avatar
sander
Release Testers
Release Testers
Posts: 8830
Joined: January 22nd, 2008, 2:22 pm

Re: Unzip ISO file

Post by sander »

mark1979smith wrote:Thanks very much for all the assistance.

Mark
Everything OK? Or are you overwhelmed by this information?
mark1979smith
Newbie
Newbie
Posts: 11
Joined: July 14th, 2012, 6:51 am

Re: Unzip ISO file

Post by mark1979smith »

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?
Post Reply