Extract Zip file to Temp folder

Discuss and share scripts and script files...
Post Reply
Jibz
Posts: 123
Joined: 15 Jun 2010 16:30

Extract Zip file to Temp folder

Post by Jibz »

This script attempts to mimic looking at and extracting from a zip file as a folder in XY. It's far from ideal, but since there is no built in support I thought it would be an interesting first project to try the scripting.

Code: Select all

"Extract Zip to Temp"
  // check extension
  if (<curext> LikeI "zip") {
    // let user abort on "large" files (2mb here)
    if (<cursize> > 2*1024*1024) {
      msg "Zip file is larger than 2 MB.<br><br>Are you sure you want to extract?", 1
    }
    // create a (relatively) unique temp folder name
    set $p, "%tmp%\<curname>_<date yyyymmddhhnnss>_" . rand(0,65536);
    set $z, "<curitem>";
    // create temp folder and unzip file there
    new "$p", dir;
    goto $p;
    run "unzip -qq $z"
  }
It takes the current file and checks if it has zip extension. If so, it creates a temporary folder in the users temp folder and extracts the zip file there and goes to it. I put in a check against large files just to avoid extracting something huge by mistake. I am using InfoZip's unzip.

admin
Site Admin
Posts: 64828
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Extract Zip file to Temp folder

Post by admin »

FYI, I'm currently researching the possibilities of adding ZIP support.

Jibz
Posts: 123
Joined: 15 Jun 2010 16:30

Re: Extract Zip file to Temp folder

Post by Jibz »

That is great news indeed!

It's probably the one single thing that would improve my use of XY most. I'm not fussed about creating archives, but being able to "go into" an archive like it is a folder and extract files by copying is a huge usability upgrade over having to use external tools or hacks like this imho.

I am excited and looking forward to hearing more :).

admin
Site Admin
Posts: 64828
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Extract Zip file to Temp folder

Post by admin »

Do you expect to see the archives in the tree then?

Jibz
Posts: 123
Joined: 15 Jun 2010 16:30

Re: Extract Zip file to Temp folder

Post by Jibz »

admin wrote:Do you expect to see the archives in the tree then?
Not really. At least in DO when you enter an archive it does not appear in the tree as far as I can tell.

Basically opening an archive works on the list just like entering a folder. You get a list of the contents just like if you were looking at a folder with it, and you can navigate it inside the list as you would a folder.

As a minimum it should be possible to extract files/folders by drag'n'drop or by copying them.

Pressing the 'Up' button should get you back to the containing folder just as if the archive had been a folder.

In DO/TC you can 'view' a file inside an archive as well, I think that's done by extracting the file to the temp folder and viewing it from there.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Extract Zip file to Temp folder

Post by Stefan »

For me, as i have seen/used this before, it's also an
- go inside the archive and show it as an folder
- view / edit / browse
- copy/extract
- add new items
- go out of archive/folder and show the archive file again

Additional thoughts:
Adding to the archive works by drag&drop too.
This whole feature is not limited to ZIP archives.
There could be an config somewhere with path to all executables and corresponding options.


I mean: for me it's an "go in/use/go out" thing.
If i "go out" all temporally files are deleted. Ans so not really an entry in path needed.

--

But as addition, maybe there could be an option to keep this temporally temp-folder
(and then show it in tree too)
And the user has to delete it on its own.
(could be nifty for big archives)

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Extract Zip file to Temp folder

Post by zer0 »

Jibz wrote:
admin wrote:Do you expect to see the archives in the tree then?
Not really. At least in DO when you enter an archive it does not appear in the tree as far as I can tell.
I would expect them to be shown in the tree, but with a possible turn-off switch. Natively, they are referred to as Compressed (zipped) Folders (and are shown as folders in Explorer since Vista), so they should be displayed as folders in the tree (with their icon).
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Jibz
Posts: 123
Joined: 15 Jun 2010 16:30

Re: Extract Zip file to Temp folder

Post by Jibz »

I am going to hesitantly throw the word "plugin" into the discussion here.

As far as I can tell XY does not have any published interface for plugins, but it is tempting to start fantasizing about a simple filesystem plugin interface that could allow access to archives, ftp, S3, etc.

The basic four operations, list files, extract file, add file and delete file are enough to interface quite a few things not supported at the moment.

Of course once you open up for that kind of thing it brings with it a ton of problems and work as well.

Personally I would be more than happy to just have read-only access to zip (and possible rar) files :).

Crash&Burn
Posts: 16
Joined: 13 Oct 2009 06:05

Re: Extract Zip file to Temp folder

Post by Crash&Burn »

Any furtherance on browsing zip/rar's within XYplorer's normal file view?

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Extract Zip file to Temp folder

Post by zer0 »

Crash&Burn wrote:Any furtherance on browsing zip/rar's within XYplorer's normal file view?
Check the roadmap link in my signature -- things are usually done in that order.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Post Reply